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

Set player's walkspeed down to 0 when he touches brick?

function touch(hit)
	if hit then
		game.Players:FindFirstChild("Humanoid") -- stuck here, don't know what to do 
	end
end

script.Parent.Touched:Connect(touch)

1 answer

✓ Accepted answer

You are doing it wrong at line 2, i think you are checking humanoid, this is how you do it:

function touch(hit)
local hum = hit.Parent:FindFirstChild("Humanoid") --- Find humanoid by the parent of the part that touched it
    if hum then -- It is exist !
        hum.WalkSpeed = 0
    end
end

script.Parent.Touched:Connect(touch)

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