How would I Fireserver in a script in server script service

How would I go about firing a remote event in a script in server script service?

You’d like to fire a remote event from a script in serverscriptservice ? If so just do

local event = game.ReplicatedStorage.Event  -- (that's an example of where your event could be)
-- you can either fire it to one player
event:FireClient(player)
-- or to all players
event:FireAllClients()

I saw this but, I want to receive the fireserver in another script which is NOT a local script

Then use a bindable event, they work the same as remote events but for the same type of scripts :

local BindableEvent = game.ReplicatedStorage.BindableEvent -- (again, this is an example)
-- fire the bindable event
BindableEvent:Fire()
-- receive the bindable event on another script or on the same script
BindableEvent.Event:Connect(function() print("hello") end)  

here’s the documentation incase

I tried, it says “Fire is not a valid member of RemoteEvent ‘ReplicatedStorage.ReviveKillPhaseUIEvent’”

here is my script that fires and receives:

local PhasesEvent = game.ReplicatedStorage:WaitForChild("ReviveKillPhaseUIEvent")

--This is the fire line
PhasesEvent:Fire(v, "IfChar")

Receiving script:

local phasesEvent = game.ReplicatedStorage:WaitForChild("ReviveKillPhaseUIEvent")
phasesEvent.Event:Connect(function(char, text)
-- My code is here
end)

Both are normal scripts not LocalScripts

Don’t use a remote event but a bindable event

1 Like

Oh…
Crap I forgot about that.
Lemme fix that

1 Like

It worked, thanks the events connect now

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