here is the script i tried (its in a part in workspace)
script.Parent.Touched:Connect(function(p) if p.Parent:FindFirstChild("Humanoid") then p.Parent.Humanoid.WalkSpeed = 25 script.Parent.Transparency = 1 script.Parent.Script.Disabled = true wait(5) script.Parent.Transparency = 0 script.Parent.Script.Disabled = false p.Parent.Humanoid.WalkSpeed = 16 end)
i disable the script so it cant be used while its invisible
thanks in advance
When you disable the script, you cannot enable it from the same script again, what you can do though to make it act like that is, use a debounce or a boolean to indicate weather you should change the speed or not like this:
local IsInvisible = false script.Parent.Touched:Connect(function(p) if IsInvisible == false then if p.Parent:FindFirstChild("Humanoid") then p.Parent.Humanoid.WalkSpeed = 25 script.Parent.Transparency = 1 IsInvisible = true else wait(5) script.Parent.Transparency = 0 p.Parent.Humanoid.WalkSpeed = 16 IsInvisible = false end end end)
You are also missing an "end" for the if statement.
You could also check if the transparency is 1 then run code otherwise, run other code... But I feel using debounce is more easier to use..
Oh and by the way, there is no point in saying script.Parent.script.Disabled = true......... script.Disabled = true is the same thing.