Im trying to make it so that when a player touches a zone, they stop getting points. I have a while loop in a serverscript that gives each player a point every second. How would I stop an intvalue from going up when a player touches the zone?
Hiya,
You can use
BasePart:GetTouchingParts() --> Returns list of touching parts
to get a table of all touching parts, using this you can check if the part is an object of a character, then getting the player using
game:GetService("Players"):GetPlayerFromCharacter(BasePart.Parent) --> Returns player object
and adding that to an exception list in your server script. like;
local exception = {} while wait(5) do for index, player in pairs(game:GetService("Players"):GetPlayers()) do if table.find(exception, player) == nil then -- Add points end end end