Firing Remote from the Client?

Sorry, the title may be misleading but I was unsure on how to phrase it.

I’m working on a Menu system where each menu is a separate ScreenGui

  • Main Menu
  • Game Selection Menu
    The Player click ‘Play’ in the Main Menu - Then it fades out.
    I was wondering if there was any way for the LocalScript in the Game Selection Menu to carry on from this?

E.G. After clicking Play, an Event within the second code is fired and then the process is began there?

Thank you.

3 Likes

you can use :FireServer() to fire a remote from the client.

1 Like

Sorry, I didn’t word it very well.
It’s from Client to Client.

Ah, you can fire a bindable event instead.
Do you mean from player to player or only local scripts in one player?

1 Like

Its from one local script to another?

You’re probably looking for a BindableEvent. Script in Game Selection Menu connects to whenever the BindableEvent is fired and will then do its task, and the LocalScript under Main Menu would fire it after it fades out.

(I would still recommend just using one LocalScript for all the UI assuming all the Guis have ResetOnSpawn disabled)

2 Likes

Then just use a bindable event in ReplicatedStorage.
You can fire bindables with :Fire() and receive them with .Event

Remote events can’t fire from Server to Server or client to client. I’m unsure you need a remote event in this case. Can you please explain what your other script is supposed to do?

Even though what @Halalaluyafail3 suggested with using just one local script for everything, Bindable Events are cool so you can use them!
Bindable Events and Functions are quite similar to Remote Events and Functions, but the catch is that, Remote Events and Function are a Server/Client or Client /Client cummunication, Bindable Events and Functions can’t communicate from server to client, they are for a communication of 2 or more scripts in just server-side or just client-side. So you can use them to communicate between 2 local scripts in the same client. And you are going to use Bindable Events, since those are for a one-message communication, while Bindable Functions recieve a message and give information back, just like Remote stuff.
You can insert a Bindable Event inside of the Main Menu local script for example.
And make it so whenever the player clicks or whatever he does, he will Fire to the other local script, you can say we have a Fire script and Listener script, one that sends the information and one that recievs it.

local event = script.BindableEvent --this would be our bindable event

event:Fire() --here we are instanly firing to the other script to work, but you are probarly gonna put this inside of an event so whenever the player clicks whatever button on the wiki he would send a signal to the other script that is going to listen to and it will do the code that's inside it.
local event = script.Parent.Parent.ScreenGui.LocalScript.BindableEvent

event.Event:Connect(function()
      --this event will fire whenever the other script :Fire()s
      --and I guess here you will put the code that is going to make the other stuff appear
end
3 Likes

I’m going to assume if you are trying to get from Client1 to Client2 some data I recommend you use a remote event to send to the server then FireClient with the other plr reciving data. If I am wrong try the methods above if you are trying to send data within the client.

Yeah exactly, he doesn’t want it to be from Client1 to Client2, he wants it from Client1 to Client1
it’s like the same client that have the 2 local scripts

1 Like

If you are trying to contact another client from the current client you would would need to fire to server with an argument of what ever client you want to send information to and then the server would send to that client. In other words localClient → Sever → Other Client. (Make sure to add checkers/configuration in the server for security purposes.)