Speed Block script doesn't work

I was experimenting and coding, watching tutorials and stuff like that. Then, I decided to make a speed block. I did a script and it didn’t work. Is there anything wrong?


local function steppedOn(part)
	local parent = part.Parent
	if game.Players:GetPlayerFromCharacter(parent) then
		parent.Humanoid.Walkspeed = 37
	end
end

speed.Touched:connect(steppedOn)
1 Like

Are there any errors in the output? Well you forgot to capitalize WalkSpeed, try this:

local function steppedOn(part)
	local parent = part.Parent
	if game.Players:GetPlayerFromCharacter(parent) then
		parent.Humanoid.WalkSpeed = 37
	end
end

speed.Touched:connect(steppedOn)
1 Like

Try this:

local function steppedOn(part)
            	local parent = part.Parent
            	if part.Parent and game.Players:GetPlayerFromCharacter(part.Parent) then
            		part.Parent:FindFirstChild("Humanoid").WalkSpeed = 37
            	end
            end

   speed.Touched:connect(steppedOn)
1 Like