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

Why doesn't this leaderstats script work?

Asked by 6 years ago

This is my leaderstats script. If the value of one of the leaderstats is less than 10, it is supposed to add the value of another leaderstat to the value of another leaderstat. It doesn't work for whatever reason. Does anyone know why? Here is my code:~~~~~~~~~~~~~~~~~ while wait(180) do for _, player in ipairs(game.Players:GetPlayers()) do if player:FindFirstChild("leaderstats") then if playerLeaderstats.subscribers.Value = <10 then player.leaderstats.views.Value = player.leaderstats.views.Value + player.leaderstats.videos.value end end end

~~~~~~~~~~~~~~~~~

0
Make sure your code embs properly as well. Otherwise, like in your case, we're stuck looking at random words all jumbled together. Tomstah 401 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

The bug is simple to spot, Because you're using the comparative operator "<=" wrong, you wrote " =< ".

while wait(180) do
    for _, player in pairs(game.Players:GetPlayers()) do
        if player:FindFirstChild("leaderstats") then 
            if playerLeaderstats.subscribers.Value <=10 then
                player.leaderstats.views.Value = player.leaderstats.views.Value + player.leaderstats.videos.value
            end
        end
    end
end
Ad

Answer this question