Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make a certain team spawn with tools?

Asked by 10 years ago

I have a Prison game and i need help making the Warden/guards spawn with tools Can someone help me, It's confusing.

1 answer

Log in to vote
0
Answered by
Dominical 215 Moderation Voter
10 years ago

If their teams have changed and they die, then they will not get the tools if their previous team was the Guards.


-- Make a model in Lighting and make it have all the tools you -- want them to spawn with. Make the model's name be "GuardTools" game.Lighting:WaitForChild("GuardTools") local teams=game:GetService("Teams") -- don't touch dis local tools=game.Lighting.GuardTools:GetChildren() FirstTeam = "Guards/Warden" -- tool team name SecondTeam = "Prisoners" -- non tool team name local team1=Instance.new("Team") team1.Name=FirstTeam team1.Parent=teams team1.TeamColor=BrickColor.new("Deep blue") local team2=Instance.new("Team") team2.Parent=teams team2.Name=SecondTeam team2.TeamColor=BrickColor.new("Bright red") game.Players.PlayerAdded:connect(function(player) player:WaitForChild("StarterGear") if player.TeamColor==team1.TeamColor then for i,v in pairs(tools) do if v.ClassName=="Tool" then v:Clone().Parent=player.StarterGear v:Clone().Parent=player.Backpack elseif v.ClassName=="HopperBin" then v:Clone().Parent=player.StarterGear v:Clone().Parent=player.Backpack end end end if player.Character~=nil and player.Character.Humanoid~=nil then player.Character.Humanoid.Died:connect(function() if player.TeamColor==team2.TeamColor then for i,v in pairs(tools) do if player.StarterGear:findFirstChild(v.Name) then player.StarterGear[v.Name]:Destroy() end end end end) end end)
Ad

Answer this question