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

Why wont this script change the value of a value on the leaderboard?

Asked by 6 years ago

This script is meant to add followers every 1-2 seconds -- Testing purposes.. But it dosen't. Anyone know why? ****Not full script, this is just the part of the followers, not other leaderboard values.

game.Players.PlayerAdded:Connect(function(plr)
    if Workspace.StarterItemsUpgraded.StarterMonitorUpgraded.SurfaceGui.Active == true then
        wait(math.random(1, 2))
        game.Players:WaitForChild("leaderstats", 120).Value = game.Players:WaitForChild("leaderstats", 120).Subscribers.Value +1
    elseif plr.leaderstats.Followers.Value >130 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(1,2) 
    elseif plr.leaderstats.Followers.Value >250 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(1,3)
    elseif plr.leaderstats.Followers.Value >350 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(1,4) 
    elseif plr.leaderstats.Followers.Value >410 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(2,4)
    elseif plr.leaderstats.Followers.Value >500 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(2,5) 
    elseif plr.leaderstats.Followers.Value >600 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(2,6) 
    elseif plr.leaderstats.Followers.Value >700 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(2,7) 
    elseif plr.leaderstats.Followers.Value >775 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,7) 
    elseif plr.leaderstats.Followers.Value >845 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,8) 
    elseif plr.leaderstats.Followers.Value >950 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,9) 
    elseif plr.leaderstats.Followers.Value >1150 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,10)
    elseif plr.leaderstats.Followers.Value >1450 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,11)
    elseif plr.leaderstats.Followers.Value >1750 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(3,12)
    elseif plr.leaderstats.Followers.Value >2000 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(4,12)
    elseif plr.leaderstats.Followers.Value >2300 then plr.leaderstats.Followers.Value = plr.leaderstats.Followers.Value + math.random(4,13)
    elseif workspace.StarterItemsUpgraded.StarterMonitorUpgraded.SurfaceGui.Active == false then 
        print("It is not on.")

    end 
end)
0
i think your trying to change the value of leaderstats itself instead of the values inside of the leaderstats from looking at the script (based off my knowledge of parameters anyway) Donut792 216 — 6y
0
What would be the fix? CoreMcNugget 15 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

Where you said

game.Players:WaitForChild("leaderstats", 120).Value = game.Players:WaitForChild("leaderstats", 120).Subscribers.Value +1

You're trying to make the leaderstats bool value equal to the subscribers value + 1. What you need to do is this:

game.Players:WaitForChild("leaderstats", 120).Subscribers.Value = game.Players:WaitForChild("leaderstats", 120).Subscribers.Value +1

Hope this works.

0
Dosent work CoreMcNugget 15 — 6y
0
oof Knineteen19 307 — 6y
Ad
Log in to vote
0
Answered by
worklok -24
6 years ago
local currency = game.Players.LocalPlayer.leaderstats.CURRENCYNAME --replace currenyname with what your curreny name is


curreny.Value = currency.Value + desirednumber --change desirednum to your desired amount

Answer this question