How to check if player is still touching the part?

The title basicly says it, just a scipt to ceck if the player is still touching the part after a touched event is fired.

Here is a simple script to do what you want, try running the script, but note that I am unable to test it as I don’t have access to your work. Anyways, I want to remind you that I didn’t write this script in a studio environment, so there’s a possibility that it may not work as intended. Let me know if it’s not worked as intented. If i fixed the issue please make sure to close your support topic by check the solution.

You can also like to support :cool:

local part = script.Parent
local playerTouching = false

local function onPartTouched(otherPart)
    if otherPart.Parent:FindFirstChildOfClass("Humanoid") then
        playerTouching = true
    end
end

local function onPartTouchEnded(otherPart)
    if otherPart.Parent:FindFirstChildOfClass("Humanoid") then
        playerTouching = false
    end
end

part.Touched:Connect(onPartTouched)
part.TouchEnded:Connect(onPartTouchEnded)

while true do
    if playerTouching then
        print("Player still touching the par :)")
    else
        print("Player is not touching the part...")
    end
    wait(1)
end
1 Like

you know the game monkey markt if not then search it up when you buy smething in the game it will take money 1 by 1 I want that but every time if one money is taken away I need to check if the layer is still on the part get it?

The scripters on the devforum are not here to create and complete your script entirely. I have provided you with the solution, so please apply it using the information and guidance I have given you along with a table using table.insert, table.find, table.remove. If i given everything to you and you don’t longer need help close this topic by check the solution, thanks :+1:

~ @hollaquetalBRUH