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

**UPDATED** Why wont this script add values to leaderstats? [closed]

Asked by 6 years ago
Edited 6 years ago

This question already has an answer here:

Why wont this script add values to the leaderboard?

What the title says. Also how do I make it instead of when the player is added, its when the player clicks on the monitor. Surface GUI with clickdetector script is already done

What I am trying to do is make it when a person clicks on the startermonitorupgraded, it activates the surfaceGUI(it does) but it dosent add the values that I have set in the script.

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

    end 
end)
0
explain at least User#23365 30 — 6y
0
Ok... CoreMcNugget 15 — 6y
0
dude? Have you ever heard of variables? User#21908 42 — 6y
0
Yes, I have, but I like typing this out. CoreMcNugget 15 — 6y
View all comments (2 more)
0
Now can someone actually answer my question.. CoreMcNugget 15 — 6y
0
I don't think you understand the whole idea of variables. Not only that but do you think we like reading this crap? You can also save some processing power if you use variables so that you are not using a million waitforchilds. User#21908 42 — 6y

Marked as Duplicate by Vezious, User#21908, User#5423, and minikitkat

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
-1
Answered by 6 years ago

print("hello")

Ad