So I'm trying to make a leaderstats script where if the value of a leaderstat is more than 10 but less than 100 it gives the player x2 of another leaderstat, Views. Views is determined by the number of another leaderstat, Videos. If the value is less than 10 the player recieves standard points. Standard points means it adds the value of Videos to Views. That works fine. However I tried to make it add 2x the value of Videos to Views and that doesn't work at all. Why? Here is a screenshot of my code: http://prntscr.com/huurx4 Where the code gets cut off on line 7, it says Value * 2 after Videos.
COMMUNITY QUESTION
Leaderstats script doesn't work, why? (Explanation exceeded the title character limit)
1 answer
OK, this seams to be easy to do, and I am happy to help.
You said your script breaks at line 7, but I have a way simpler way of doing this. So basically we will do for i,players do so it runs in each player. This script needs to run in the Starter GUI
while wait(3) do
for i, player in ipairs(game.Players:GetChildren()) do
local player = script.Parent.Parent
if player:FindFirstChild("leaderstats") then
if player.leaderstats.Subscribers.Value <= 10 then
local views = player.leaderstats.Views
local Videos = player.leaderstats.Videos
views.Value = Views.Value + Videos.Value
end
if player.Leaderstats.Subscribers.Value <= 10, and > 10 then
local views = player.leaderstats.Views
local Videos = player.leaderstats.Videos
local multiply = views.Value = views.Value + views.Value
views.Value = Views.Value + multiply
end
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Could you make an edit and add that code section to this article so we can see it without having to go to a different website?