so I’m making game and I want player move right if he press q don’t ask me why
this is the script
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local humanoid = player.Character:FindFirstChild("Humanoid")
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:connect(function(keyCode)
if keyCode.keyCode == Enum.KeyCode.Q then
humanoid:Move(Vector3.new(1, 0, 0), true)
end
end)
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local usi = game:GetService("UserInputService")
usi.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q then
humanoid:Move(Vector3.new(1, 0, 0), true)
end
end)
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local Character = game.Players.LocalPlayer.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:connect(function(keyCode)
local HRP = Character:FindFirstChild("HumanoidRootPart")
if keyCode.keyCode == Enum.KeyCode.Q then
humanoid:MoveTo(HRP.Position + Vector3.new(1,0,0))
end
end)
Edit: you can change the 1,0,0 to be a bigger number lol
put the script in a local script, and make the local script’s parent starterplayer > starterplayerscripts
or u can put it in starter gui, and it should work.