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

PlayerGui isn't a valid member of part?

I'm working on a strategy game called Solid. You find a secret door that leads to a deadly fire pit, but before you die, the screen turns black. But in the output it says...

21:45:02.089 - PlayerGui is not a valid member of Part 21:45:02.090 - Script 'Workspace.Teleporter.Script', Line 3 21:45:02.090 - Stack End

Here's the script.

script.Parent.Touched:connect(function(player)
	game.Workspace.ScarySound1:Play()
	player.PlayerGui.Gui.BlackScreen.Visible = true
end)

player.PlayerGui did work in a different script. (Not a localscript) Doing it the same way.

2 answers

✓ Accepted answer

Try doing it from the gui.

tp = workspace.Teleporter


tp.onTouched()
    game.Workspace.ScarySound1:Play()
    script.Parent.BlackScreen.Visible = true
end)

tp.Touched:connect(onTouched)

put that in a localscript under the BlackScreen imagelabel/frame.

1 comment

0

I edited it a bit, and it worked. It didn't need to be under or in a localscript. Thanks bro.

PlayerGui is not in workspace so therefor can not be in line 3. But to do what you are trying to do you would have to go though Players.

1 comment

0

player.PlayerGui not Workspace.PlayerGui

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