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

WalkSpeed scipt gone wrong?

idk what am I doing wrong, but anyways i want the script to change your walkspeed

script.Parent.ClickDetector.MouseClick:Connect(function(lol)
	local humanoid = lol.Parent:FindFirstChild("Humanoid")
	if humanoid ~= nil then
	humanoid.WalkSpeed = 0
	end
end)

2 comments

0

more context?

0

When a part is clicked your WalkSpeed is set to 0

1 answer

To check if the player has a humanoid you need to use an if statement correctly like i have done below

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    local Character = workspace:WaitForChild(player.Name)
    if Character:FindFirstChild('Humanoid') then
    Character.Humanoid.WalkSpeed = 0
    end
end)

3 comments

0

didnt work

0

oh wait let me edit one second

0

Try now i forgot this was using a click detector mb

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