Advertisement
MarkiPro

Untitled

Jan 25th, 2020
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. local uis = game:GetService("UserInputService")
  2. local access1Function = game.ReplicatedStorage:WaitForChild("access1Function")
  3. local thing = workspace.machines.bed1
  4. local position = workspace.machines.bed1.handle.CFrame
  5. local RS = game:GetService("ReplicatedStorage")
  6. local tpFunction = RS:WaitForChild("TpFunction")
  7. local tpPart = thing.invisiblePart
  8. local billboard = thing.part.BillboardGui
  9. local player = game:GetService("Players").LocalPlayer
  10. local character = player.Character
  11. local maxDistance = thing.part.BillboardGui.MaxDistance
  12. local distance = (thing.part.Position - character.HumanoidRootPart.Position).magnitude
  13.  
  14. --// Variables
  15. local E_toggle = false
  16.  
  17. uis.InputBegan:Connect(function(input, gameProcessed)
  18. local distance = (thing.part.Position - character.HumanoidRootPart.Position).magnitude
  19. E_toggle = false
  20. if input.KeyCode == Enum.KeyCode.E and distance <= maxDistance then
  21. if gameProcessed then return end
  22. local Tool = access1Function:InvokeServer()
  23. local animationid = script.animation1
  24. local animation1track = character.Humanoid:LoadAnimation(animationid)
  25. tpFunction:InvokeServer(character, tpPart)
  26. character.Humanoid.JumpPower = 0
  27. character.Humanoid.WalkSpeed = 0
  28. animation1track:Play()
  29. wait(animation1track)
  30. animation1track:Stop()
  31. if E_toggle then
  32. E_toggle = true
  33. if input.KeyCode == Enum.KeyCode.E then
  34. thing.Handle.CFrame = position
  35. local animationid3 = script.animation3
  36. local animation3track = character.Humanoid:LoadAnimation(animationid3)
  37. animation3track:Play()
  38. wait(animation3track)
  39. animation3track:Stop()
  40. game.ReplicatedStorage.ToolFunction1:InvokeServer(character)
  41. E_toggle = false
  42. character.Humanoid.JumpPower = 31
  43. character.Humanoid.WalkSpeed = 18
  44. end
  45. end
  46. end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement