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

Help With Script Problems?

This script is in a script. It tests if the leaderstats Quest Value is 0 if its true then it will enable the script.

local players = game.Players:children()
while wait(.1) do 
if players.leaderstats.Quest.Value == 0 then
	script.Parent.Disabled = false
else
	script.Parent.Disabled = true
end
end

3 answers

local players = game.Players:GetChildren()
while wait(.1) do
if players.leaderstats.Quest.Value == 0 then
    script.Parent.Disabled = false
else
    script.Parent.Disabled = true
end
end

Try this:

local players = game.Players:GetChildren()
while true do
wait(.1)
for index, player (players) do	
	if player.leaderstats.Quest.Value == 0 then
    script.Parent.Disabled = false
	else
    script.Parent.Disabled = true
end
end

Or this:

local players = game.Players:GetPlayers()
while wait(.1) do
	for i=1,#players do
		if players[i].leaderstats.Quest.Value == 0 then
	    		script.Parent.Disabled = false
		else
	    		script.Parent.Disabled = true
		end
	end
end

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