Im trying to make it so the player is only permited to spawn 1 tool, and when they die they can get it again. This script isnt working any fixes?
local player = game.Players.LocalPlayer
local valueBought = player.BoughtItem
local tool = game.Lighting:FindFirstChild(“ClassicSword”)
script.Parent.MouseButton1Click:Connect(function()
if valueBought.Value == false then
local a = tool:Clone()
a.Parent = player.Backpack
valueBought.Value = true
end
end)
game:GetService(‘Players’).PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild(“Humanoid”).Died:Connect(function()
valueBought.Value = false
end)
end)
end)