Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Ik how to find out if a player enters region3. But how do i find out if player has left region3?

Asked by 4 years ago
        while true do
            wait(0.5)
            local partsinregion = workspace:FindPartsInRegion3(region, part, 1000)
            local playerFound = {}
            for i, part in pairs(partsinregion) do
                if part.Parent:FindFirstChild("Humanoid") ~= nil then
                    print("Player found in region!" .. part.Parent.Name)
                    playerFound[part.Parent.Name] = true


                    local playerr1 = part.Parent.Name
                    local playerr2 = game.Players:FindFirstChild(playerr1)
                    local frame = playerr2.PlayerGui.Craftinggui.Frame
                    frame.Craftingtablegui.Visible = true


                end
            end
        end
    end
end

1 answer

Log in to vote
0
Answered by
ryan32t 306 Moderation Voter
4 years ago

You could try having a table and inserting the player's name into the table once the player has walked into the region3. and the while loop could also try running through the table containing all players who entered region3 and checking if the person is still in the region3 or if they person is not in the region3.

Ad

Answer this question