~~~~~~~~~~~~~~~~~ --Trying to make the script to where when you step on (Block) it makes your speed 75
function speedBlock() print ("Character Speed Equals 75") Block.Touched.Humanoid.Walkspeed = 75
end Block.Touched:connect(speedBlock) ~~~~~~~
well, the script doesn't know what Block is and also, you have to make the humanoid's walkspeed 75 not the thing touching it(example:right leg, left leg), one last thing, is you should probably make sure the thing touching it is part of a player
script.Parent.Touched:connect(function(hit)--put scripting under the part local Character=hit.Parent:GetChildren() for i,v in pairs(Character) do if v.Name=="Humanoid" then--checks if it is a player hit.Parent.Humanoid.WalkSpeed=75 end end end)
There are many problems with your script.
Firstly, you never defined 'Block', used in your connection statement. 'Block' is nil. Secondly, you don't index the part that touched with [Part].Touched
. You have to set a parameter in your 'speedBlock' function, this parameter will help you access the part that touched due to the fact that Touched Events
return the part that touched.
So, to fix your script?
local Block = game.Workspace.Part --Define 'Block' here Block.Touched:connect(function(hit) print ("Character Speed Equals 75") if hit.Parent:FindFirstChild("Humanoid") ~= nil then hit.Parent.Humanoid.WalkSpeed = 75 end end)
You might also want to consider adding a Debounce