How to make an automatic running system?

Enum is not correct. It is Enum.KeyCode.Space

ah right

must be a localscript bro
also can you show the starterplayerscript folder

image

It is a localscript

Okay so this works perfectly for what I’m trying to do… how can I increase the speed though?

Changing Vector3 value will make it go further away, changing wait will make it go faster. If you mean walking speed, change walkspeed value from StarterPlayer.

click on the starterplayer folder and change a property called WalkSpeed to whatever you want

that doesnt do anything…

1 Like

What do you mean? Changing Vector3 value will make it go further away, changing wait will make it go faster. If DevTigerr means the walking speed, then it must be thru the WalkSpeed.

It depends what DevTigerr meant.

you are using while loop just dont do that use runservice like i did

Changing wait to what will make it go faster?

just dont do that…

The actual function will be faster by that, atleast worked for me. However like Creeper said, you should use RunService. Change it to 0.01. And for editing walkspeed, go to StarterPlayer properties and change walkspeed from CharacterWalkSpeed.

local plr=game.Players.LocalPlayer
local hum=plr.Character.Humanoid
hum.WalkSpeed= --your walkspeed here
game:GetService("RunService").RenderStepped:Connect(function()
   plr:Move(Vector3.new(1,0,0))
end
local uis=game:GetService("UserInputService")
uis.InputBegan:Connect(function(input)
   if input.KeyCode == Enum.KeyCode.Space then
      hum.Jump=true
   end
end)

did it work @DevTigerr ?

Like I said, the output tells me that

is attempting to index nil will humanoid

doesnt work… and has the exact same error message

I realised that, I am attempting to solve.

local plr = game:GetService("Players").LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local hum = character:FindFirstChild("Humanoid")
	
local uis = game:GetService("UserInputService")
game:GetService("RunService").RenderStepped:Connect(function()
	plr:Move(Vector3.new(1,0,0))
end)

uis.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.Space then
		if hum then
			hum.Jump = true
		end
	end
end)

Tested and worked, do not name it ControlScript. You can change speed in StarterPlayer properties in CharacterWalkSpeed.

9 Likes

why not name it controlscript if you dont then it could use wasd to move right?

No, this would not work. You can’t use WASD. Also I am pretty sure that my code is something that works just like the OP wanted.