Hey, I'm developing a training facility, and I made a script that gives you tools/GUIs if you are in a team (for example, if you are in the Red Team you get a pistol, etc..) It works when a player joins, but it doesn't work after the player dies. I want the script to work after a player dies. Note: This is a LocalScript
local code = require(game.ReplicatedStorage:WaitForChild("TeamAssets").Settings)
local plr = game.Players.LocalPlayer
local char = plr.Character
assets = game.ReplicatedStorage:FindFirstChild("TeamAssets")
function giveitem(asset,location)
if assets:findFirstChild(asset) == nil then print('Error - could not find asset '..asset) return end
if plr:findFirstChild(location) == nil then print('Error - could not find player child '..location) return end
--local newasset = assets[asset]:Clone()
--newasset.Parent = plr[location]
if location=="Backpack" then
workspace.Remotes.Equipper:FireServer(asset,nil,true,code.code)
end
if location=="PlayerGui" then
assets:FindFirstChild(asset):Clone().Parent=plr.PlayerGui
end
end
if plr.TeamColor == BrickColor.new 'White' then
giveitem('ArmorBlue','PlayerGui')
giveitem('Detain','Backpack')
end
if plr.TeamColor == BrickColor.new 'Really red' then
giveitem('ArmorRed','PlayerGui')
end
I'll really appreciate it if someone helps me with this.

1 comment
What folder is the script in?