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

Help With Script Problems?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago
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
Ad
Log in to vote
0
Answered by 9 years ago

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
Log in to vote
0
Answered by 9 years ago

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

Answer this question