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)
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)
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;