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

attempt to index nil with 'enabled' error?

Asked by 4 years ago

Hi. im trying to make a script that temporarily disables your chat. This is my code. it is a local script, and the parent of the local script is Player Gui.

x = script.Parent:FindFirstChild("Chat")
wait()
while true do
    if game.Workspace.Current.Value ~= script.Parent.Parent.TeamColor then
        x.Enabled = false
    else
        x.Enabled = true
    end
end

1 answer

Log in to vote
0
Answered by 4 years ago

Im kinda stupid, i had to put wait for child instead of find first child, and i had to put the wait() in the loop not before

Ad

Answer this question