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)

6 comments
explain at least
Ok...
dude? Have you ever heard of variables?
Yes, I have, but I like typing this out.
Now can someone actually answer my question..
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.