Im trying to make a brick that lets you walk on it with a certain walkspeed but I thought I did everything right but it does not work. Here it is:
Player = game.Player.LocalPlayer function onTouch(part) if Player.Walkspeed = 40 then part.CanCollide = true else part.CanCollide = false script.Parent.Touched:connect(onTouch)
I still don't see where I'm wrong?
script.Parent.Touched:connect(function(hit) if game.workspace:FindFirstChild(hit.Parent.Name):WaitForChild('Humanoid').WalkSpeed == 40 then script.Parent.CanCollide = true else script.Parent.CanCollide = false end end)
Alright. in the function hit
, that is the person who touches that brick. To find him/her in workspace, we use hit.Parent.Name
. Then, we look for humanoid, and then check for walkspeed. If the walkspeed is 40, it will be solid. If not, it will not be solid. Keep in mind, if 2 people touch it at the same time, (one person with 16 walkspeed and one with 40 walkspeed), the brick will be glitchy, and will flash.