Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How could I fire an SERVER event from a LocalScript?

Three objects: BindableEvent, Script and LocalScript. I need the local script to fire the bindable event which can be detected from a server script like this:

BindableEvent.Fired:Connect(function()

	-- code

end)

Is there ANY way this is possible?

2 comments

0

Correct me if I'm wrong, you want to detect when a remote event is fired on the server side?

0

Oh, no i messed up, sorry if i wasted your time

1 answer

✓ Accepted answer

This is not possible with BindableEvents. There is nothing in those that could replicate from the client to the server without being filtered. However, RemoteEvents are designed precisely for your use case. You can connect to the event on the server like so:

RemoteEvent.OnServerEvent:Connect(function(player, arg1, arg2) -- etc.
	-- code
end)

And in a LocalScript, you can fire it like so:

RemoteEvent:FireServer(arg1, arg2) -- etc.

Note that firing from client to server, the server automatically fills in the player argument (it's the player who fired the event).

Further reading on RemoteEvents (Roblox Wiki)

2 comments

0

if you want confirmation that this is not possible, please read the first paragraph on the roblox wiki page for bindableevents: https://developer.roblox.com/en-us/api-reference/class/BindableEvent

0

big thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.