In my script it can recognize if there are no players on a certain team. I want this script to be able to recognize if a new model enters the Workspace named "HostageFree"
This is my script:
local BluePlayers=0 function GetAmountOnBlue() BluePlayers=0 local Players=game.Players:GetChildren() for _,Player in pairs(Players) do if Player.TeamColor==BrickColor.new("Bright blue") then BluePlayers=BluePlayers+1 end end end while script.Parent do wait() GetAmountOnBlue() if BluePlayers==0 then script.Parent.Transparency=1 script.Parent.CanCollide=false script.Parent.ScaryScript.Disabled = true else script.Parent.ScaryScript.Disabled = false script.Parent.Transparency=0 script.Parent.CanCollide=true end end
Once the script recognizes a new model in workspace it needs to be able to do something like my script does above. Like: kill all players on bright red team but just before that giving everyone on bright red team 300 credits (actually need that).
game.Workspace.ChildAdded:connect(function(child) if child.Name == "HostageFree" then -- do stuff end end)