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

Leaderstats script works like a dream in Studio, but not ingame, can someone help?

This is one of my scripts. It is supposed to take the value of Videos and add it to the value of Views every 2 minutes. It works perfectly in Studio, but not the game it is on. If anyone wants to see the game it is on, here it is: https://web.roblox.com/games/1300877434/OPEN-Be-a-YouTuber-ALPHA#!/about I don't know if that will help answer my question or not, but just in case I put it there. Here is my script:

while wait(120) do
	for _,player in pairs(game.Players:GetChildren()) do
		if player:FindFirstChild("leaderstats")then
			if player.leaderstats.Subscribers.Value <= 10 then
				player.leaderstats.Views.Value = player.leaderstats.Views.Value + player.leaderstats.Videos.Value
			end
		end
	end
end

######Edited ~ tab your code correctly

1 answer

When theres more than one player in the game it will add their videos to their views as soon as they get in if the wait was over. You have to put a value in the character itself that records the amount of time they played. Every time that reaches 120 you would then do the math. Hope I helped.

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