I have a Prison game and i need help making the Warden/guards spawn with tools Can someone help me, It's confusing.
✓ ANSWER ACCEPTED
How do i make a certain team spawn with tools?
1 answer
✓ Accepted answer
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.
