local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local humanoid, rootPart
local function updateMovement()
print("Update movement running")
if humanoid then
local movementVector = Vector3.new(1,0,0)
humanoid:Move(movementVector, false)
print("Humanoid found, moving.")
end
end
player.CharacterAdded:Connect(function(character)
humanoid = player.Character:WaitForChild("Humanoid")
rootPart = player.Character:WaitForChild("HumanoidRootPart")
print("humanoid and rootpart loaded")
end)
RunService:BindToRenderStep("Movement", Enum.RenderPriority.Input.Value, updateMovement)
This is code I have in a LocalScript in StarterPlayerScripts. “Update movement running”, “Humanoid found, moving”. and “humanoid and rootpart loaded” all print to the console. But the character isn’t moving right. It just stays still, and alows normal movement, which I don’t want. I want the character to move right, always. What do I do?
EDIT: I believe the issue lies with the Move function itself. I changed updateMovement() to just humanoid.Health = 0 so it just instakills the player and THAT WORKS. So it’s the Humanoid:Move.
EDIT: Changing updatemovement to this:
local function updateMovement()
humanoid:Move(Vector3.new(1,0,0), false)
end
Produces an error: attempt to index nil with ‘Move’