Update a Value every second a player is inside a specific part

You should use ZonePlus. You can use the .playerEntered() event to check when a player enters a specifig zone.
Something like this:

local ZoneModule = require(path.to.Zone)
local RadioactiveZone = ZoneModule.new(path.to.part)
local inZone = {}

RadioactiveZone.playerEntered:Connect(function(player)
   inZone[player] = true

   while inZone[player] do
      --do stuff
   end
end)

RadioactiveZone.playerExited:Connect(function(player)
   inZone[player] = false
end)
3 Likes