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

PlayerGui Not a valid member of Player?

local RunService = game:GetService('RunService')

-- Game Services
local NotificationManager = require(script.NotificationManager)
local TimerManager = require(script.TimerManager)

-- Local Variables

local Events = game.ReplicatedStorage.Events
local DisplayIntermission = Events.DisplayIntermission
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local ScreenGui = script.ScreenGui

local InIntermission = false

-- Initialization

game.StarterGui.ResetPlayerGuiOnSpawn = false
ScreenGui.Parent = Player.PlayerGui

It states when I open the console: scripts 'Players.thecoolminecartYT.PlayerScripts.Displayscripts', line22

When I use the dev edition(Roblox Studio) there is no error whatsoever

2 comments

0

Is it a local script?

0

You can't access PlayerScripts or PlayerGUI directly with a server script. Instead, use a RemoteEvent or RemoteFunction in the player's backpack to let a localscript know to make the changes.

1 answer

Well, If you are trying to locate PlayerGui you need to do this:

-- make a remote event inside ReplicatedStorage

-- then make a local script inside StarterPlayer > StarterPlayerScripts with:

game.ReplicatedStorage.RemoteEvent:FireServer()

-- after that make a script inside workspace saying:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:connect(function()
local RunService = game:GetService('RunService')

-- Game Services
local NotificationManager = require(script.NotificationManager)
local TimerManager = require(script.TimerManager)

-- Local Variables

local Events = game.ReplicatedStorage.Events
local DisplayIntermission = Events.DisplayIntermission
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local ScreenGui = script.ScreenGui

local InIntermission = false

-- Initialization

game.StarterGui.ResetPlayerGuiOnSpawn = false
ScreenGui.Parent = Player.PlayerGui

end)


Let me know if it doesn't still doesn't work. BTW This is for Filtering Enabled.

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