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.
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.
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.