Here's my script:
wait(5)
function changeweapon()
local player = game:GetService("Players").LocalPlayer
if player.leaderstats.Kills.Value == 1 then
player.Backpack["GLOCK-17"]:Destroy()
game.ReplicatedStorage.Guns["USP-S"]:Clone().Parent = player.Backpack
print("usp-s")
end
if player.leaderstats.Kills.Value == 2 then
player.Backpack["USP-S"]:Destroy()
game.ReplicatedStorage.Guns["Beretta"]:Clone().Parent = player.Backpack
print("beretta")
end
end
script.Parent.Parent.leaderstats.Kills.Changed:connect(changeweapon)
wait(.2)
changeweapon()
I want this script to do something like, if you have 1 kill, you will get a USP-S and lose your GLOCK-17 you spawned with. On your second kill, you will lose your USP-S and get a Beretta. My script only works when I manually change the number of kills I have in the explorer. It doesn't work in a real game. I have a working leaderboard and a kills/deaths script.

1 comment
The problem could be that the weapons themselves aren't registering as a kill on the leaderboard, thus making the script unable to work.