ttvmetroidd

Untitled

Jun 19th, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. local Tool = script.Parent
  2.  
  3. local Remote = Tool:WaitForChild("Remote",10)
  4.  
  5. local MouseInput = Tool:WaitForChild("MouseInput",10)
  6.  
  7. local Services = {
  8. Players = (game:FindService("Players") or game:GetService("Players")),
  9. TweenService = (game:FindService("TweenService") or game:GetService("TweenService")),
  10. RunService = (game:FindService("RunService") or game:GetService("RunService")),
  11. Input = (game:FindService("ContextActionService") or game:GetService("ContextActionService"))
  12. }
  13.  
  14. local Player,Character,Humanoid
  15.  
  16.  
  17. function Primary(actionName, inputState, inputObj)
  18. if inputState == Enum.UserInputState.Begin then
  19. Remote:FireServer(Enum.KeyCode.Z)
  20. end
  21. end
  22.  
  23. function Secondary(actionName, inputState, inputObj)
  24. if inputState == Enum.UserInputState.Begin then
  25. Remote:FireServer(Enum.KeyCode.X)
  26. end
  27. end
  28.  
  29.  
  30. function Equipped()
  31. Player = Services.Players.LocalPlayer
  32. Character = Player.Character
  33. Humanoid = Character:FindFirstChildOfClass("Humanoid")
  34. if not Humanoid or not Humanoid.Parent or Humanoid.Health <= 0 then return end
  35.  
  36. Services.Input:BindAction("Primary",Primary,true,Enum.KeyCode.Z,Enum.KeyCode.ButtonX)
  37. Services.Input:BindAction("Secondary",Secondary,true,Enum.KeyCode.X,Enum.KeyCode.ButtonY)
  38. Services.Input:SetTitle("Primary","Time Change")
  39. Services.Input:SetTitle("Secondary","Light Travel")
  40. Services.Input:SetPosition("Primary",UDim2.new(.5,0,-.5,0))
  41. Services.Input:SetPosition("Secondary",UDim2.new(.5,0,0,0))
  42. end
  43.  
  44. function Unequipped()
  45. Services.Input:UnbindAction("Primary")
  46. Services.Input:UnbindAction("Secondary")
  47. end
  48.  
  49. Tool.Equipped:Connect(Equipped)
  50. Tool.Unequipped:Connect(Unequipped)
  51.  
  52.  
  53. function MouseInput.OnClientInvoke()
  54. return game.Players.LocalPlayer:GetMouse().Hit.p
  55. end
Advertisement
Add Comment
Please, Sign In to add comment