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

PlayerGui Not a valid member of Player?

Asked by 6 years ago
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

0
Is it a local script? R_alatch 394 — 6y
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. whenallthepigsfly 541 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question