Is it possible to transfer functions in :Fire() functions?

Hey Devs,
I was wondering if it is possible to add functions like this
EDIT: local script:

local Points = 1
game.ReplicatedStorage.RemoteEvent:FireServer(Points)

and in the server script:

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
print(Points)

This function will surely not work but I think now you understand what I am trying to do!
Any help would be appreciated! :grin:

Yeah, of course you can !

Local script

local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent" ,30)
local Points = 1

if Event ~= nil then
	Event:FireServer(Points) --Here you can write all things you need to send with the remote event.
end

Server script

local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent" ,30)

if Event ~= nil then
	Event.OnServerEvent:Connect(function(Player, Points) -- "player" as first argument is required to make it work and get the player that used the remote event ^^ then write your other things in the same order than the other script.
		print(Points)
	end)
end
1 Like

Thank you for your fast reply! I marked it as the Solution!

1 Like

Sorry for the late reply, but is this possible to server to client too?

I tried making this:
Local Script:

local Event = game.ReplicatedStorage:WaitForChild("Rebirth")

Event.OnClientEvent:Connect(function(Player, Points)
	if Event ~= nil then
		script.Parent.Visible = true
		script.Parent.Points.Value = Points
	end
end)

It works tho but the Value doesn’t change… I have a number value in the frame and this value gets changed as you see in the lines above. Sadly this doesn’t works… I also added a print function but ion output it just say nil…

nevermind i fixed it, my bad :slight_smile: