here is my script, I wanted to make a system when a player enters a certain zone, then he has a sign and it says cold at the player, when the player leaves the zone, the sign went to zero and was removed, but the scripts do not work
ServerScriptService:
local EventIn = game:GetService(“StarterGui”).CRPlayer.InZone
EventIn.OnServerEvent:Connect(function(plr)
if plr.PlayerGui.Core.AnnFrame:FindFirstChild(“COLSTATUS”) then
game:GetService(“Players”).LocalPlayer:WaitForChild(“leaderstats”).ColdS.Value += 1
else
game:GetService("Players").LocalPlayer:WaitForChild("leaderstats").ColdS.Value += 1
local tempcold = game:GetService("ServerStorage").COLDSTATUS:Clone()
tempcold.Parent = plr.PlayerGui.Core.AnnFrame
end
end)
local EventOut = game:GetService(“StarterGui”).CRPlayer.OutZone
EventOut.OnServerEvent:Connect(function(plr2)
if game:GetService("Players").LocalPlayer:WaitForChild("leaderstats").ColdS.Value >= 0 then
game:GetService("Players").LocalPlayer:WaitForChild("leaderstats").ColdS.Value -= 1
–[[ elseif game:GetService(“Players”).LocalPlayer:WaitForChild(“leaderstats”).ColdS.Value <= 0 and plr2.PlayerGui.Core.AnnFrame:FindFirstChild(“COLSTATUS”) then
game:GetService("Players").LocalPlayer:WaitForChild("leaderstats").ColdS.Value += 1
local tempcold = game:GetService("ServerStorage").COLDSTATUS:Clone()
tempcold.Parent = plr2.PlayerGui.Core.AnnFrame
]]
end
end)
–plr2.PlayerGui.Core.AnnFrame:FindFirstChild(“COLSTATUS”)
StarterGUI:
local SoundRegionsWorkspace = game.Workspace:WaitForChild(“ColdestRegions”)
local Found = false
while wait(1) do
for i, v in pairs(SoundRegionsWorkspace:GetChildren()) do
Found = false
local region = Region3.new(v.Position - (v.Size/2),v.Position + (v.Size/2))
local parts = game.Workspace:FindPartsInRegion3WithWhiteList(region, game.Players.LocalPlayer.Character:GetDescendants())
for _, part in pairs(parts) do
if part:FindFirstAncestor(game.Players.LocalPlayer.Name) then
print("player was found")
Found = true
break
else
Found = false
print("player was not found in region")
end
end
if Found == true then
script.InZone:FireServer()
elseif Found == false then
script.OutZone:FireServer()
end
end
end