game.ReplicatedStorage.ToolEvents.SwordEvent:Connect(function(player)
if player.leaderstats.CashValue>=100 then
player.leaderstats.CashValue = player.leaderstats.CashValue - 100
game.ServerStorage.Tools.Sword:Clone().Parent = player.Backpack
end
end)
Also here is what the code should look like! If you are doing this ServerSided, which I suppose you should because you are connecting leader stats with it.
game.ReplicatedStorage.ToolEvents.SwordEvent.OnServerEvent:Connect(function(player)
if player.leaderstats.Cash.Value >= 100 then
player.leaderstats.Cash.Value -= 100
game.ServerStorage.Tools.Sword:Clone().Parent = player.Backpack
end
end)
Now remember, on the local side you would be putting.
game.ReplicatedStorage.ToolsEvent:FireServer()
Another thing I could point out is depending if you want the gear to stay with the player throughout the whole game instead of just when they respawn then…