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

What is wrong with this Touched Script?

script.Parent.Touched(function(part)
	local h = part.Parent.Humanoid
	if h ~= nil then
		h.WalkSpeed = 45
	end
end)

I think I just did a careless mistake. But nothing is showing up in the Output.

1 comment

0

Please don't edit your titles to say "[Closed]" in them. When they actually get locked that's done automatically

1 answer

✓ Accepted answer

You missed the calling the connect method on the Touched event:

script.Parent.Touched:connect(function(part)
    local h = part.Parent:FindFirstChild("Humanoid") --also use FindFirstChild
    if h then --"if h" is the same as "if h ~= nil"
        h.WalkSpeed = 45
    end
end)

1 comment

0

Wow I feel stupid, especially since I made the same mistake yesterday...

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