I want it so when the player is not touching the brick anymore, it stops removing the value at line 9
function onTouched(hit)
hit = game:GetService("Players").LocalPlayer
shower = true
while shower == true do
wait(1)
if hit ~= nil then
if hit.PlayerGui.UI.Sections.Fatigue.Fatigue.Value >= 5 then
hit.PlayerGui.UI.Sections.Fatigue.Fatigue.Value = hit.PlayerGui.UI.Sections.Fatigue.Fatigue.Value-5
end
elseif hit == nil then
shower = false
end
end
end
script.Parent.Touched:connect(onTouched)

2 comments
What do you want to happen to this ? What do you want to happen when the player touches the brick? If you tell me that I may be able to help you.
when the player touch the brick, if the fatigue.value is >= 5 then it remove 5 from it this part is working but it keep doing it even if i dont touch it anymore