Hi everyone,
I wanted to find out how to test if a player is always touching a block? I am making a terminal script
SCRIPT \/
function onTouch(part) script.Parent.Parent.Screen.SurfaceGui.Bar.Progress.True.Value = true end while wait(1) do script.Parent.Touched:connect(onTouch) end
How would I do that?
You need to make a while loop checking if the parent "Humanoid" exists, something like this:
function onTouch(part) local humanoid = part.Parent:FindFirstChild("Humanoid") while humanoid do -- While the humanoid exists do.... script.Parent.Parent.Screen.SurfaceGui.Bar.Progress.True.Value = true wait(1) -- We wait 1 second before progressing again the bar end end script.Parent.Touched:connect(onTouch)