Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My Kill Tracker Doesn't Work?

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

0

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

1 answer

The problem is that you don't have a sensor for if you kill something. This means that if you kill something, it won't count for a kill on the leaderboard. Although I personally have no experience in this field, so I can't give you any specific scripts, I hope you find what you are looking for.

This discussion is preserved as it was. New answers, comments, and votes are closed.