Ducksneedhelp1

Server Script For HD Application

Dec 28th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. --[[
  2.  
  3.  
  4. All positions of floors where the elevator should arrive at.
  5.  
  6. Floor 1 elevator position: 34.7, 0.3, 34.1
  7. Floor 2 elevator position: 34.7, 14.6, 34.1
  8. Floor 3 elevator position: 34.7, 30.9, 34.1
  9.  
  10.  
  11.  
  12.  
  13. ]]--
  14.  
  15.  
  16. local TweenService = game:GetService("TweenService")
  17. local elevatorPart = game.Workspace.Elevator
  18.  
  19.  
  20. local informationForTween = TweenInfo.new(
  21.  
  22. 7,
  23. Enum.EasingStyle.Quad,
  24. Enum.EasingDirection.InOut,
  25. 0,
  26. false,
  27. 0.2
  28. )
  29.  
  30. local propertiesForFloor2_Destination = {CFrame = CFrame.new(7, 14.6, 34.1)}
  31. local propertiesForFloor3_Destination = {CFrame = CFrame.new(34.7, 30.9, 34.1)}
  32. local propertiesForFloor1_Destination = {CFrame = CFrame.new(34.7, 0.3, 34.1)}
  33.  
  34. local createTweenToFlr2 = TweenService:Create(elevatorPart, informationForTween, propertiesForFloor2_Destination)
  35. local createTweenToFlr3 = TweenService:Create(elevatorPart, informationForTween, propertiesForFloor3_Destination)
  36. local createTweenToFlr1 = TweenService:Create(elevatorPart, informationForTween, propertiesForFloor1_Destination)
  37.  
  38.  
  39. game.ReplicatedStorage.Floor1Event.OnServerEvent:Connect(function(player, elevator)
  40. elevatorPart.Anchored = false
  41. print("Unanchoring part")
  42. if not elevatorPart.CFrame == CFrame.new(34.7, 0.3, 34.1) then
  43. createTweenToFlr1:Play()
  44. if elevatorPart.CFrame == CFrame.new(34.7, 0.3, 34.1) then
  45. elevatorPart.Anchored = true
  46. print("Anchoring Part")
  47. end
  48. end
  49. end)
  50.  
  51. game.ReplicatedStorage.Floor2Event.OnServerEvent:Connect(function(player, elevator)
  52. elevatorPart.Anchored = false
  53. if not elevatorPart.CFrame == CFrame.new(7, 14.6, 34.1) then
  54. createTweenToFlr2:Play()
  55. if elevatorPart.CFrame == CFrame.new(7, 14.6, 34.1) then
  56. elevatorPart.Anchored = true
  57. end
  58. end
  59. end)
  60.  
  61. game.ReplicatedStorage.Floor3Event.OnServerEvent:Connect(function(player, elevator)
  62. elevatorPart.Anchored = false
  63. if not elevatorPart.CFrame == CFrame.new(34.7, 30.9, 34.1) then
  64. createTweenToFlr3:Play()
  65. if elevatorPart.CFrame == CFrame.new(34.7, 30.9, 34.1) then
  66. elevatorPart.Anchored = true
  67. end
  68. end
  69. end)
Advertisement
Add Comment
Please, Sign In to add comment