GUI changes for server but not for client

Hello!
I am a fairly experienced scripter and was wondering, in a server sided script I change a GUI made from the server script’s parent but it only appears as the different child in the server but not the client, now I know why this happens but how can I fix it? I tried firing a remote event to all clients, had a local script pick it up in the starter player scripts and have it change the parent but it didn’t work because it couldn’t find the GUI since it was made inside of the server script, anybody know how to help?

1 Like

I dont understand the problem very good.
Maybe, create the GUI store it in ServerStorage, then clone the GUI and give it to all players, keep using the local script and the remote event to change the GUI from the clients

1 Like

Good idea, I’ll try that, one moment.

Your not referencing StarterGui, right? You want to use the Players PlayerGui.

1 Like

How do I do that? I usually just do it like this:

local gui = game.StarterGui.Gui

something like:

local Playa = game.Players.LocalPlayer
local playerGui = Playa:WaitForChild("PlayerGui")
local FunShop = playerGui:WaitForChild("FunShopGui")
1 Like

It isn’t working for me, this is a script I have inside of Starter Player Scripts:

game.ReplicatedStorage.ChangePosition.OnClientEvent:Connect(function(checkPos)
	local leader = game.StarterGui.LeaderBoardGui:GetChildren()
	local playerGui = game.StarterGui:WaitForChild("PlayerGui")
	local screenGui = playerGui:WaitForChild("LeaderBoardGui")
	local frame1 = screenGui:WaitForChild("Frame1")
	local posGui = frame1:WaitForChild("PlayerPos")
	posGui.Parent = frame1
end)

This is incorrect. PlayerGui objects are connected to the Player object, in which case you’d reference in a LocalScript. The StarterGui is what UI objects are inserted into a PlayerGui. Grab the PlayerGui instead of trying to change stuff in StarterGui.

Example:

local Players = game:GetService("Players")

local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")

-- do stuff here with this playergui
1 Like

Thank you times a million! That also goes to @Dev_Peashie and @grif_0. Thank you so much I didn’t even notice that because I am so tired.

2 Likes