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

Does anyone know why my script isn't working?

Asked by 9 years ago

Why isn't this script working, and nothing comes into the output? The script doesn't even create new instances. The script:

wait(4)
isPlay = script.Parent.isPlaying.Value
PlayerCount = 0
while wait() do
    -- Checks if the Parent Player is playing the game --
if isPlay == false then
-- PlayerList visible --    
script.Parent.PlayerList.Visible = true
-- Getting to see if players are already added. Basically a refresh, If a player joins the game, the player will be added to the player list. --
for i,v in pairs(game.Players:GetChildren()) do

    if v:IsA("Player") then

    for i,f in pairs(script.Parent.PlayerList:GetChildren()) do

    if f:IsA("StringValue") then


    if v.Name == f.Value or v.Name == script.Parent.Parent.Parent.Name then

        return  

    end 
    -- Adds the new Player stuff --
    local newPlayer = Instance.new("StringValue")
    newPlayer.Parent = script.Parent.PlayerList
    PlayerCount = PlayerCount + 1
    newPlayer.Value = v.Name

    local newPlayerText = Instance.new("TextButton")
    newPlayerText.Parent = script.Parent.PlayerList
    local copyofinvite = script.Invite:Clone()
    local copyofareplaying = script.ArePlaying:Clone()

copyofinvite.Parent = newPlayerText

copyofareplaying.Parent = newPlayerText

copyofinvite.Disabled = false

copyofareplaying.Disabled = false   

    newPlayerText.Style = 3

    newPlayerText.Position = UDim2.new(0 , 0 , 0.1 *PlayerCount, 0)

    newPlayerText.Size = UDim2.new(1, 0, 0, 50)

    newPlayerText.TextColor3 = Color3.new(255,255,255)



newPlayerText.Name = v.Name

local newPlayerValue = Instance.new("StringValue", newPlayerText)

newPlayerValue.Value = v.Name

newPlayerValue.Name = "PlayerValue"

    end

    end

    end
end
-- If the Parent Player is playing, make the PlayerList Invisible. --
elseif script.Parent.isPlaying == true then

script.Parent.PlayerList.Visible = false

end

end

1 answer

Log in to vote
1
Answered by
nilVector 812 Moderation Voter
9 years ago

In the beginning, your variable should be:

isPlay = script.Parent.isPlaying

Then, when you check for the value, you would do it like this:

if isPlay.Value == false then
     --Code
end
Ad

Answer this question