Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ContextActionService = game:GetService("ContextActionService")
- local Players = game:GetService("Players")
- local player = Players.LocalPlayer
- local camera = workspace.CurrentCamera
- local mouse = player:GetMouse()
- local PLAYER_SPEED = 70000
- local FORWARD_KEY = Enum.KeyCode.W
- local forwardForceVector = Vector3.new(0,0,-PLAYER_SPEED)
- local function onMove(actionName, inputState)
- if inputState == Enum.UserInputState.Begin then
- player.Character.HumanoidRootPart.VectorForce.Force = forwardForceVector
- elseif inputState == Enum.UserInputState.End then
- player.Character.HumanoidRootPart.VectorForce.Force = Vector3.new(0,0,0)
- end
- end
- local function onAim()
- if player.Character then
- local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
- local mouseLocation = Vector3.new(mouse.Hit.X, rootPart.Position.Y, mouse.Hit.Z)
- rootPart.CFrame = CFrame.new(rootPart.Position, mouseLocation)
- rootPart.CFrame *= CFrame.Angles(0, math.rad(180), 0)
- end
- end
- ContextActionService:BindAction("Aim", onAim, false, Enum.UserInputType.MouseMovement)
- ContextActionService:BindAction("Aim_and_Move", onMove, false, Enum.UserInputType.MouseButton1)
- ContextActionService:BindAction("Move", onMove, false, FORWARD_KEY)
Advertisement
Add Comment
Please, Sign In to add comment