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

Why doesn't this leaderstats script work?

This is my leaderstats script. If the value of one of the leaderstats is less than 10, it is supposed to add the value of another leaderstat to the value of another leaderstat. It doesn't work for whatever reason. Does anyone know why? Here is my code:~~~~~~~~~~~~~~~~~ while wait(180) do for _, player in ipairs(game.Players:GetPlayers()) do if player:FindFirstChild("leaderstats") then if playerLeaderstats.subscribers.Value = <10 then player.leaderstats.views.Value = player.leaderstats.views.Value + player.leaderstats.videos.value end end end


1 comment

0

Make sure your code embs properly as well. Otherwise, like in your case, we're stuck looking at random words all jumbled together.

1 answer

The bug is simple to spot, Because you're using the comparative operator "<=" wrong, you wrote " =< ".

while wait(180) do
	for _, player in pairs(game.Players:GetPlayers()) do
		if player:FindFirstChild("leaderstats") then 
			if playerLeaderstats.subscribers.Value <=10 then
				player.leaderstats.views.Value = player.leaderstats.views.Value + player.leaderstats.videos.value
			end
		end
	end
end

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