Event wont fire in server script

im trying to fire an server in a server script in serverscriptservice to make some gui appear but it wont fire…

here is the server script

if ChosenMap.Name == "THESTOPGOGAME" then
	print("ah")
	Events:WaitForChild("guistopngo"):FireAllClients()
	

the script under the event to make it work

script.Parent.OnServerEvent:Connect(function(plr)
	print("ehe")
end)
	

2 Likes

Are you attempting to make the gui appear for all clients or just the local client? Additionally are the scripts local scripts or normal scripts?

1 Like

these are all normal scripts, and im trying to make the gui appear for everyone in the server.

1 Like

Your supposed to use OnClientEvent instead of OnServerEvent for the 2nd script

1 Like

but it doesnt show up when im writing it, is it normal?

Yeah you should still use OnClientEvent. Aswell as, the 2nd script must be a local script.

okay, where should i put the local script, still under the event in replicated storage?

Try placing it in StarterGui instead of ReplicatedStorage

okay im gonna try this thanks!

It still doesn’t fire, here is what i changed in the second script :
(i put it in a folder in starter gui)

script.Parent.OnClientEvent:Connect(function(plr)
print("eeh")
end)

there’s also no error in the console

this is why you learn how to script before actually doing it

what do you mean? i have experience

You need to index the remote event in your code, for example:

RemoteEvent.OnClientEvent:Connect

And make sure the remotevent is in replicatedstorage.

like this?
image

Events:WaitForChild("guistopngo").OnClientEvent:Connect(function()
     print("Recieved on client")
end)

ohh i know i already did that. let me try again

For the server do something like:

Events:WaitForChild("guistopngo"):FireAllClients()

It would obviously not work due to the tremendous amounts of mistakes here is a explaination about remote events

Definition
RemoteEvents are used for server-client or client-server communication.

Sending Messages/Events
You can send a message or event using RemoteEvent:FireServer() Depending on script either Server or Clients. If its server it would be :FireAllClients() or :FireClient(Player) for client it would be :FireServer.

Recieving Messages/Events
To recieve messages you need to use RemoteEvent.OnClientEvent:Connect(function). Depending on what script it is in i.e if local it would be RemoteEvent.OnClientEvent:Connect(function), and for server it would be RemoteEvent.OnServerEvent:Connect(function)

Learn more here →

1 Like

I already wrote that, but it now says in the console

Players.isaagomendabuilder.PlayerGui.EventsHandler:3: attempt to index nil with 'PlayerGui'