Hi I want to make a safe zone that pauses players time when they get in and when they get out there time goes again
local TimeAlive = 0
local Shards = 0
local Exp = 0
local Levels = 0
local GUIClient = false
local Humanoid;
game:GetService("Players").PlayerAdded:Connect(function(P)
local Stats = Instance.new("Folder", P)
Stats.Name = "leaderstats"
local ClientTester = Instance.new("Folder", P)
ClientTester.Name = "ClientTester"
local BT = Instance.new("IntValue", Stats)
local TA = Instance.new("IntValue", Stats)
local SHARDS = Instance.new("IntValue", Stats)
local EXP = Instance.new("IntValue", Stats)
local LEVELS = Instance.new("IntValue", Stats)
local GUICLIENT = Instance.new("BoolValue", ClientTester)
TA.Name = "TimeAlive"
BT.Name = "BestTime"
SHARDS.Name = "Shards"
EXP.Name = "Exp"
LEVELS.Name = "Levels"
GUICLIENT.Name = "GUICLIENT"
GUIClient = GUICLIENT
TimeAlive = TA
BestTime = BT
Shards = SHARDS
Exp = EXP
Levels = LEVELS
P.CharacterAdded:Connect(function(C)
Humanoid = C:WaitForChild("Humanoid")
end)
end)
while true do
wait()
if Humanoid then
if Humanoid.Health > 0 then
TimeAlive.Value += 1
print(TimeAlive.Value)
wait(1)
else
if BestTime.Value > 0 then
if TimeAlive.Value > BestTime.Value then
BestTime.Value = TimeAlive.Value
print("Giving A New Best Time!")
end
else
BestTime.Value = TimeAlive.Value
end
print("Time Alive ", TimeAlive.Value, " Best Time ", BestTime.Value)
TimeAlive.Value = 0
wait(.1)
end
end
end