OnServerInvoke is a callback member of RemoteFunction; you can only set the callback value, get is not available

I’m trying trying to make a seats left system for my airline’s self-check-in.

I get the error: “OnServerInvoke is a callback member of RemoveFunction; you can only set the callback value, get is not available”

I tried looking on the developer forum and I found nothing that could help me.

Client script: The important part is after the else. Tweens doesn’t matter.

CheckInFrame.EcoFrame.CheckIn.MouseButton1Click:Connect(function()
	local seatsLeft = CheckInFrame.EcoFrame.SeatsLeftFrame.SeatNumber
	if seatsLeft.Text == "0" then
		CheckInFrame.EcoFrame["Check-InBox"].Text.Text = "Full"
		CheckInFrame.EcoFrame.CheckIn:Destroy()
		wait(3)
		WelcomeFrame.Visible = true
		CheckInFrame:TweenPosition(
			UDim2.new(-1, 0, 0, 0),
			"Out",
			"Quad",
			0.5,
			false
		)
		WelcomeFrame:TweenPosition(
			UDim2.new(0, 0, 0, 0),
			"Out",
			"Quad",
			0.5,
			false
		)
		wait(0.5)
		CheckInFrame.Visible = false
		CurrentFrame = "WelcomeFrame"
		LastFrame = "CheckInFrame"
		CheckInFrame.Position = UDim2.new(1, 0, 0, 0)
	else
		ReplicatedStorage:WaitForChild("Main2"):InvokeServer("ec1")
	end
end)

Server script:

local Main2 = game:GetService("ReplicatedStorage"):WaitForChild("Main2")

Main2.OnServerInvoke:connect(function(plr, command)
	if command == "ec1" then
		for i,v in pairs(game.Players:GetPlayers()) do
			v.PlayerGui.SCIGui.Main.CheckInFrame.EcoFrame.SeatsLeftFrame.SeatNumber.Text = v.PlayerGui.SCIGui.Main.CheckInFrame.EcoFrame.SeatsLeftFrame.SeatNumber.Text -1
		end
	end
end)

I don’t seem to find the issue. It might be obvious but I don’t know.

OnServerInvoke is not a signal. You need to define it.

Main2.OnServerInvoke = function(plr, command)
    -- Your Main2 code here. It should return a value.
end
7 Likes

So how would I format this to add more?

Thanks, I found out that it worked. Really appreciate it.