Attempt to call a nil value

LocalScript:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
ReplicatedStorage:WaitForChild("RemoteFunction").OnClientInvoke = function(i)
	return i()
end

Server:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
	ReplicatedStorage.RemoteFunction:InvokeClient(player, function()
		print("I like my cheese drippy bruh")
	end)
end)

When I run the code, it just errors “attempt to call a nil value”
Does anyone know a workaround?

You cannot directly pass a function as argument i guess.

oh i REALLY wish we could, I DONT WANT TO MAKE A REMOTE FOR EVERY DAMN THING!!

you could invoke the message and print it on the other side.

unfortunately…

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