#Check if the player is touching a part is = false

2 messages · Page 1 of 1 (latest)

winged fog
#

How can i check if the player is still touching a part?

I am trying to make a script that runs while the player is touching the part , its like this

`repeat

        humanoid.Health = humanoid.Health + 10 
        wait(1)
        pisando = false
        print("cura")

until humanoid.Health == 100 or hit.Parent:IsAncestorOf(hit.Parent:FindFirstChild('Humanoid')) == false`

its just a part of the script

i want to do the function dont repeat when the player is not touching the part

#

`local area = script.Parent
local pisando = false

area.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild('Humanoid')

if humanoid and pisando == false then 
    pisando = true 
    repeat

        humanoid.Health = humanoid.Health + 10 
        wait(1)
        pisando = false
        print("cura")
    until humanoid.Health == 100 or hit.Parent:IsAncestorOf(hit.Parent:FindFirstChild('Humanoid')) == false

end

end)`

this the script