I need to give a tool to The Player But when I test it does basically nothing I’ve tried search the Dev Forum for a while now and have came back empty Handed
here is The code that does not work
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
local leaderstats = player.leaderstats.level
local e = leaderstats
if e.Value == 2 then
player.Backpack.Sword:Destroy()
local sword = game.Lighting["non-gamepass-swordS"].Baton:Clone()
sword.Parent = player.Backpack
end
if e.Value == 7 then
player.Backpack.Batom:Destory()
local sword = game.Lighting["non-gamepass-swordS"].Icesword:Clone()
sword.Parent = player.Backpack
end
if e.Value == 15 then
player.Backpack.Sword:Destroy()
player.Backpack.Batom:Destory()
player.Backpack.Icesword:Destory()
local sword = game.Lighting["non-gamepass-swordS"]["Spirit Sword"]:Clone()
sword.Parent = player.Backpack
end
if e.Value == 25 then
player.Backpack["Spirit Sword"]:Destory()
local sword = game.Lighting["non-gamepass-swordS"]["Blood Sword"]:Clone()
sword.Parent = player.Backpack
end
if e.Value == 34 then
player.Backpack["Blood Sword"]:Destory()
local sword = game.Lighting["non-gamepass-swordS"]["Crimson Sword"]:Clone()
sword.Parent = player.Backpack
end
if e.Value == 50 then
player.Backpack["Crimson Sword"]:Destory()
local sword = game.Lighting["non-gamepass-swordS"]["Purple sword"]:Clone()
sword.Parent = player.Backpack
end
if e.Value == 70 then
player.Backpack["Purple sword"]:Destory()
local sword = game.Lighting["non-gamepass-swordS"][Power sword"]:Clone()
sword.Parent = player.Backpack
end
end)
end)
well its because when the player dies the player looses its tools so i basically added that in so the player does not loose the the sword when the player dies