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

Leaderstats script works in Studio, but not ingame? (I'm getting tired of posting this)

Asked by 6 years ago

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. The script was edited by another user a few posts ago and now i see no reason why it shouldn't work. Here is the script:

while wait(120) do
for _,Player in pairs(game.Players:GetChildren()) do
local leaderstats = Player:WaitForChild("leaderstats")
local subs = leaderstats:WaitForChild("Subscribers")
local Views = leaderstats:WaitForChild("Views")
local Videos = leaderstats:WaitForChild("Videos")
local num = 10
if subs.Value <= num then
Views.Value = Views.Value + Videos.Value
end
end
end
0
You should use probably use GetPlayers instead of GetChildren, but I don’t know if that will change anything. mattscy 3725 — 6y

Answer this question