Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make a button that sets your walkspeed ?

(on a gui) i am stuck with this :

local walkbtn = script.Parent local player = game.Players.LocalPlayer local Character = player:WaitForChild("Character") local humanoid = Character:WaitForChild("Humanoid")

walkbtn.MouseButton1Down:connect(function() humanoid.WalkSpeed = 100 end)

and it dosnt work pls dont bully me am trash at scripting

1 comment

0

Consider clicking accept answer on the answer that helped so both you and the answerer gets reputation

2 answers

✓ Accepted answer

You're using WaitForChild on a property, not a child. All you need to do is to replace local Character = player:WaitForChild("Character") with local Character = player.Character. Your also using a script as you showed earlier, change to a localscript.

4 comments

0

Then your using localplayer on a script, not a localscript, change to a localscript.

0

do you have discord?

0

" This will return nil if the character hasn't loaded yet" Hes calling the player not the character, a player can exist without a character.

0

ty it works now

"Character" is not a child of player.

Instead do

local character = player.Character or player.CharacterAdded:Wait() -- waits for the character to load

4 comments

0

this still doesnt work

0

Might want to share any errors showing up.

0

local walkbtn = script.Parent local player = game.Players.LocalPlayer local Character = player.Character or player local humanoid = Character:WaitForChild("Humanoid") walkbtn.MouseButton1Down:connect(function() humanoid.WalkSpeed = 100 end) so like this

0

You didn't use my fix. it's not "or player", it's "or Player.CharacterAdded:Wait()"

This discussion is preserved as it was. New answers, comments, and votes are closed.