1: How to classify all Semi-SafeZones as an Tagged
Parent. –
local CollectionService = game:GetService("CollectionService")
local function RegisterSemiSafeZone(SemiSafeZone : Model)
SemiSafeZone.Touched:Connect(function(Touch)
if Touch.Parent:FindFirstChild("Humanoid") then
local Player = game:GetService("Players"):GetPlayerFromCharacter(Touch.Parent)
if Player then
if not Player.PlayerGui:FindFirstChild("CloneTouch") then
local CloneGui = game:GetService("ServerScriptService"):FindFirstChild("Semi-SafeZoneHandler"):FindFirstChild("SafeZoneGui"):Clone() -- Name of Gui
CloneGui.Name = "CloneTouch"
CloneGui.Parent = Player.PlayerGui
SemiSafeZone.TouchEnded:Connect(function(NoTouch)
if Touch == NoTouch then
game:GetService("Debris"):AddItem(CloneGui, 0)
end
end)
end
end
end
end)
-- Semi-SafeZone Tag
for _, v in pairs(CollectionService:GetTagged("Semi-SafeZone")) do
task.spawn(RegisterSemiSafeZone, v)
print("Tagged")
end
end