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

PlayerGUI is not a valid member of Player?

I have written this script which has ScreenGUI in it in workspace and Screen GUI intro gets destroyed after clicking the play button and it's script is in Starter GUI ..I have the problem in workspace script and error is PlayerGUI is not a valid member of Player whenever I play it in server.

game.Players.PlayerAdded:Connect(function(player) local guide = script:FindFirstChild("Screen GUI") gui:Clone().Parent = player.PlayerGUI end)

2 answers

Add The ScreenGui In The Workspace

The Name Is "PlayerGui" And Not "PlayerGUI"

game.Players.PlayerAdded:Connect(function(Player)
local guide = game.Workspace:WaitForChild("ScreenGui"):Clone()
guide.Parent = Player.PlayerGui
end)

2 comments

0

It was Gui only just a typing error but still didn't work

0

Are the screengui inside of the workspace and named "ScreenGui"??

LOCALSCRIPT

local Player = game:GetService("Players").LocalPlayer;
local PlayerGui = Player:WaitForChild("PlayerGui");
local Clone = PlayerGui:WaitForChild("ScreenGui"):Clone();
Clone.Parent = PlayerGui;

SERVERSCRIPT

game:GetService("Players").PlayerAdded:Connect(function(Player)
local PlayerGui = Player:WaitForChild("PlayerGui");
local Clone = PlayerGui:WaitForChild("ScreenGui"):Clone();
Clone.Parent = PlayerGui;

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