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

Change Walkspeed when you Step on a Brick?

I want to do this for one of my games, and I don't have a single clue how to do it, I don't even know what to code for this. Please help!

1 comment

1

This is not a request site. That information can be found by referring to one of Roblox's uploaded videos on YouTube (Hour of Code Part 3) or the Roblox Wiki.

3 answers

very simple

script.Parent.Touched:connect(function(hit)
h = hit.Parent:findFirstChild("Humanoid")
if h ~= nil then
h.WalkSpeed = 45
end
end)

Adding on to chimmihc's answer:

brick = script.Parent -- the script is inside the brick so we make it a variable

brick.Touched:connect(function(hit) -- We create a touch event using a function with a parameter of hit

h = hit.Parent:findFirstChild("Humanoid") -- We look for the humanoid of the player

if h ~= nil then -- If the humanoid exists then...

h.WalkSpeed = 45 -- We set their walkspeed to 45

end

end)

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