ScreenGui not working serverside through the use of a screen button

The RemoteEvent is under ReplicatedStorage. I’m also going to attach a few other pictures that may help you understand how everything is lined up a bit better.
image

(The highlighted script is the script in question, the additional scripts apply to the other controls, which all work as expected)
image

Again, it would be too much to put here, but there is no Output errors linked to it, so I’m not quite sure where it’s going wrong. Again, I’m a relative amateur catching on pretty quick, haha.

Thanks again for your help and Merry Christmas! :santa:

Awh, unfortunately, I don’t have a solution then. I hope you are able to fix this issue! Thank you for your time! :slight_smile:

You can’t access every client’s PlayerGui from one client’s script. FireAllClients is meant for Server-to-client communication, which is why we need to loop through every player and do it that way.

I’m not sure what the standpoint here is, FireAllClients wouldn’t need iteration through each player. There’d be no need I can see for client-to-client referencing GUI’s here from what I can tell by what OP is trying to achieve. What @LifeDigger and I were suggesting is something structured like this (don’t have studio on hand so forgive me if I write an error):

Localscript

local function onClick()
	game.ReplicatedStorage.ControlPanelTest.cruiseannc:FireServer()
end

local function onAnnc()
	local Cruising = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("Cruising")

	Cruising.Frame1.Visible = true
	wait(4)
	Cruising.Frame1.Visible = false
	Cruising.Frame2.Visible = true
	wait(7)
	Cruising.Frame2.Visible = false
	Cruising.Frame3.Visible = true
	wait(9)
	Cruising.Frame3.Visible = false
	Cruising.Frame4.Visible = true
end

game.ReplicatedStorage.ControlPanelTest.cruiseannc.OnClientEvent:Connect(onAnnc)
script.Parent.MouseButton1Down:Connect(onClick)

Server script:

game.ReplicatedStorage.ControlPanelTest.cruiseannc.OnServerEvent:Connect(function(Player)
        game.Workspace.ControlPanelTest.AudioBlock.DingDong.Playing = true
	game.ReplicatedStorage.ControlPanelTest.cruiseannc:FireAllClients()
end)

*Edited to add the sound back to the server script

1 Like

What would the placement be for these scripts? I currently have the LocalScript as a child of the button and the ServerScript just placed in the models. Would it remain this way?

Ideally the server script goes into ServerScriptService so it’s not replicated to the clients. LocalScript would stay the same

This also has no output errors but the GUI still doesn’t want to show.

The only output error is that there is, is that there is no ‘ControlPanelTest’ in ReplicatedStorage. When I deleted ControlPanelTest to make it look directly for the RemoteEvent no additional errors showed up.

Let’s add some debug statements and more explicit references to see where it’s going wrong:
Server script:

local cruiseAnnc = game:GetService("ReplicatedStorage"):WaitForChild("cruiseannc")

cruiseAnnc.OnServerEvent:Connect(function(ply)
	print(ply.Name .. " has requested an announcement. Playing sound:")
	game.Workspace.ControlPanelTest.AudioBlock.DingDong.Playing = true
	print("Firing the event to all the clients:")
	cruiseAnnc:FireAllClients(ply.Name)
end)

Local script:

local ply = game:GetService("Players").LocalPlayer
local cruiseAnnc = game:GetService("ReplicatedStorage"):WaitForChild("cruiseannc")

local function onClick()
	print("Button clicked, firing at the server...")
	cruiseAnnc:FireServer()
end

local function onAnnc(name)
	print("Received an announcement from " .. name)
	
	local Cruising = ply.PlayerGui:FindFirstChild("Cruising")
	
	if Cruising then
		print("Found the Cruising frame")
		Cruising.Frame1.Visible = true
		wait(4)
		Cruising.Frame1.Visible = false
		Cruising.Frame2.Visible = true
		wait(7)
		Cruising.Frame2.Visible = false
		Cruising.Frame3.Visible = true
		wait(9)
		Cruising.Frame3.Visible = false
		Cruising.Frame4.Visible = true
		print("Finished!")
	else
		print("Cruising frame not found! :(")
	end
end

cruiseAnnc.OnClientEvent:Connect(onAnnc)
script.Parent.MouseButton1Down:Connect(onClick)

*Edit, forgot to reference the event on client the same way

Weird, this worked! Give me just a second so that I can find someone to join me and make sure it works serverside.

1 Like

You can also test multiple players in Studio by going to the “Test” tab, and under the banner for Clients and Servers, select how many players to emulate and hit Start.

Cool, learn something new everyday. Nope, still clientsided :confused:

How far along do the debug statements go? Does it get to the “Found cruising” part, or does the event not happen at all?

UPDATE: When the person clicks the gui button, it will show for the whoever is in the seat. When they click, it will show for them, and when they hop out, I will sit and it will do then show for me.

Is the “Cruising” frame only enabled/parented to the players’ GUI should they be in the seat? Sounds like my snippet of code does work, but something else is contributing to it not working as intended.

image

The “Cruising” GUI is in StarterGUI.

Okay, so there’s a bug somewhere. Can you check that the Cruising frame is visible when the client event is executed? Say, try adding a line “Cruising.Visible = true” right under “if Cruising then…”

Cruising is actually the name of the ScreenGUI.
image

The ScreenGUI itself is enabled, but the frames are not enabled, this is expected to be done by the script. I edited the script to include

Cruising.Enabled = true

although it is already enabled, the separate frames are just not visible, to prevent it from permanently being displayed on their screen.

I was thinking exactly that just did not wanna get into an arguement ngl.

1 Like

Haha, any feedback helps. There wouldn’t be any arguments, haha.

Do you by chance know what else it could be @MP3Face? Thanks for your help!

THIS WAS ORIGINALLY POSTED BY @Chatowillwin ON A DIFFERENT POST

This worked for me.

(If @Chatowillwin posts this on this post, I will mark him as the solution.)