heres the script:
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") -- Find humanoid if (humanoid ~= nil) then -- Check for humanoid humanoid.WalkSpeed = 8 end end script.Parent.Touched:connect(onTouch)
there is no errors but i want it so only when the person is touching the part their walk speed is lowered and when they leave the part their walk speed is back to normal
Use touchended:
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") -- Find humanoid if (humanoid ~= nil) then -- Check for humanoid humanoid.WalkSpeed = 8 end end function TouchEnded(part) local humanoid = part.Parent:FindFirstChild("Humanoid") -- Find humanoid if (humanoid ~= nil) then -- Check for humanoid humanoid.WalkSpeed = 16 end end script.Parent.Touched:connect(onTouch) script.Parent.TouchEnded:Connect(TouchEnded)
Closed as Not Constructive by hiimgoodpack, BashGuy10, and pwx
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?