How to fire an event to a client

Running it through one event is worse (in most cases)

Having multiple events keeps it more organized because you already know what parameters you are going to send/recieve

1 Like

Oh. I didnā€™t know, Iā€™m new to coding so Iā€™m just kind of trying to make sense of it all on the fly. Forgive me if I say some braindead things.

Itā€™s fine, i also suck at it lol. I would watch a tutorial on remote events so that you can get a better idea on how they work.

1 Like

Iā€™m good at Client > Server but this is my first time trying to do Client > Server and back to Client

If you need Client > Server > Client, use RemoteFunctions. RemoteEvents are one-way

1 Like

Oh ok. It is pretty much the same except that :FireServer() doesnā€™t need a player argument.

1 Like

Oh RemoteFunctions, let me look up their API

Remote events are one way? You can use :FireServer or :FireClient on them though and you can provide parameters.

1 Like

One way as in client > server and vice-versa. RemoteEvents donā€™t return anything

2 Likes

Adding on to this, Iā€™m pretty sure this could sort of ā€œoverloadā€ that one event and is generally not good practice. Think of remotes like a bridge. It would be better to have multiple bridges where all the events cross instead of one bridge wheere all the events are crammed together.

3 Likes

Youā€™re right, that makes a lot of sense.

I got the Client > Server > Client system working, now I just need to rough out the edges but thank you to all of you. It genuinely means a lot to me

1 Like

You can pass all kinds of perimeters in one FireServer

-- local script in StarterPlayerScripts or StarterGui

local rs = game:GetService("ReplicatedStorage")
local DomainEvent = rs:WaitForChild("DomainEvent")

task.wait(4)

DomainEvent:FireServer("DomainExpansion", "2nd perimeter", "3rd perimeter", 4)
-- server script in ServerScriptService

local rs = game:GetService("ReplicatedStorage")
local DomainEvent = rs:WaitForChild("DomainEvent")

DomainEvent.OnServerEvent:Connect(function(Player, Key1, Key2, Key3, Key4)

	print(Player)
	print(Key1)
	print(Key2)
	print(Key3)
    print(Key4)

end)

1st one is always the player ā€¦

Oh I see so I can just use it to pass along whatever information I want, thatā€™s very very helpful

Seriously? Thatā€™s kind of stupid.

1 Like

Ya, always break questions down into prints and focus on just that, then you know for sure. Notice I didnā€™t even declare the local player at all. Server knows who it came from.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.