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

PlayerGUI is not a valid member of Player?

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)
0
It was Gui only just a typing error but still didn't work AnimeGamingEmperor -1 — 5y
0
Are the screengui inside of the workspace and named "ScreenGui"?? Lava_Scripter 109 — 5y
Ad
Log in to vote
0
Answered by
Syclya 224 Moderation Voter
5 years ago
Edited 5 years ago

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;

Answer this question