Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Kill Tracker Doesn't Work?

Asked by 6 years ago
Edited 6 years ago

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.

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. noob1126 34 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question