Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

2 comments

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)

0

What would be the fix?

2 answers

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.

2 comments

0

Dosent work

0

oof

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

This discussion is preserved as it was. New answers, comments, and votes are closed.