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

Can someone tell me whats wrong? It wont spawn the venomshank in my backpack.

Asked by
Proflts 15
9 years ago
kills = game.Workspace.LeaderboardV3.leaderstats.KOs

script.Parent.ClickDetector.MouseClick:connect(function(Buy)
    if kills >= 0 then
        for i,v in pairs(game.Players:GetChildren()) do
            if v.Backpack ~= nil then
                clone2 = game.Lighting.Venomshank:Clone()
                clone2.Parent = v.Backpack              
            end
        end
    end
end)
0
Line 4, maybe. | if kills.Value >=0 then | Also, on line 6, use v:FIndFirstChild("Backpack") to check if the Backpack instead. Redbullusa 1580 — 9y
0
thanks bro Proflts 15 — 9y
0
it didnt work Proflts 15 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

This is what you did wrong: in the first line you defined kills as the leaderstat in the player. So you are basically saying that if the leaderstat kills = 0 then you get it. You get the sword. You want to define the value. So then you will be saying if the player has 0 kills then buy the sword.

kills = game.Workspace.LeaderboardV3.leaderstats.KOs.Value

So this would be the script:

kills = game.Workspace.LeaderboardV3.leaderstats.KOs.Value

script.Parent.ClickDetector.MouseClick:connect(function(Buy)
    if kills >= 0 then
        for i,v in pairs(game.Players:GetChildren()) do
            if v.Backpack ~= nil then
                clone2 = game.Lighting.Venomshank:Clone()
                clone2.Parent = v.Backpack              
            end
        end
    end
end)

0
whenever i click it it says leaderstats is invalid value or something like that Proflts 15 — 9y
Ad

Answer this question