Hasli4

RBLX. ControlScript

May 15th, 2025
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. local ContextActionService = game:GetService("ContextActionService")
  2. local Players = game:GetService("Players")
  3.  
  4. local player = Players.LocalPlayer
  5. local camera = workspace.CurrentCamera 
  6. local mouse = player:GetMouse()
  7. local PLAYER_SPEED = 70000
  8. local FORWARD_KEY = Enum.KeyCode.W
  9.  
  10. local forwardForceVector = Vector3.new(0,0,-PLAYER_SPEED)
  11.  
  12. local function onMove(actionName, inputState)
  13.     if inputState == Enum.UserInputState.Begin then
  14.         player.Character.HumanoidRootPart.VectorForce.Force = forwardForceVector
  15.     elseif inputState == Enum.UserInputState.End then
  16.         player.Character.HumanoidRootPart.VectorForce.Force = Vector3.new(0,0,0)
  17.     end
  18. end
  19.  
  20. local function onAim()
  21.     if player.Character then
  22.         local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
  23.         local mouseLocation = Vector3.new(mouse.Hit.X, rootPart.Position.Y, mouse.Hit.Z)
  24.         rootPart.CFrame = CFrame.new(rootPart.Position, mouseLocation)
  25.  
  26.         rootPart.CFrame *= CFrame.Angles(0, math.rad(180), 0)  
  27.     end
  28. end
  29.  
  30. ContextActionService:BindAction("Aim", onAim, false, Enum.UserInputType.MouseMovement)
  31.  
  32. ContextActionService:BindAction("Aim_and_Move", onMove, false, Enum.UserInputType.MouseButton1)
  33.  
  34. ContextActionService:BindAction("Move", onMove, false, FORWARD_KEY)
  35.  
Advertisement
Add Comment
Please, Sign In to add comment