InvokeServer is not a valid member of RemoteEvent

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make it so the error doesn’t show up in the error logs.

  2. What is the issue? Include screenshots / videos if possible!
    “InvokeServer is not a valid member of RemoteEvent”

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I’ve tried adding InvokeServer as a RemoteEvent into the ReplicatedStorage Folder path for it, but it still shows up the error.

Script:

local mainFrame = script.Parent:WaitForChild('Frame')
local Player = game:GetService('Players').LocalPlayer
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Function = ReplicatedStorage:WaitForChild('Shared'):WaitForChild('Remotes'):WaitForChild('VehicleSystem')

local Dealers = workspace:WaitForChild('CarDealership'):WaitForChild('Dealers')
Dealers:WaitForChild('Raider') Dealers:WaitForChild('Providence') 
local connections = {}

wait(2)

for _, typeDealer in next, Dealers:GetChildren() do
	print(typeDealer.Name)
	spawn(function()
		local module = Function:InvokeServer({action = 'RequestInfo', type = typeDealer.Name}) -- this is the line its giving the InvokeServer Event error on
		if module then 
			for _, dealer in next, typeDealer:GetChildren() do
				print(dealer.Name)
				repeat wait(0.5) print('Finding torso') until dealer:FindFirstChild('Torso')
				repeat wait(0.5) until mainFrame:FindFirstChild('List')
				dealer.Torso.ClickDetector.MouseClick:Connect(function()
					print('Click')
					for _, v in next, mainFrame.List:GetChildren() do
						if v:IsA('Frame') then
							v:Destroy()
						end
					end
					print('Destroyed')
					
					for i, v in next, module do
						local price = v.dollars
						
						local new = mainFrame.Example:Clone()
						new.VehicleName.Text = tostring(i)
						new.Buy.Text = 'Buy ('.. tostring(price) ..')'
						new.Parent = mainFrame.List
						new.Visible = true
						
						local buyConnection buyConnection = new.Buy.MouseButton1Click:Connect(function()
							local Return = Function:InvokeServer({action = 'PurchaseVehicle', vehicle = i, type = dealer.Parent.Name})
						end)
					end
					local exitConnection exitConnection = mainFrame.Exit.MouseButton1Click:Connect(function()
						mainFrame.Visible = false
						exitConnection:Disconnect()
					end)
					mainFrame.Visible = not mainFrame.Visible
				end)
			end
		end
	end)
end

wait(1)

pcall(function()
	
end)

Script is in a LocalScript as the Client.

You cant use InvokeServer() on RemoteEvents, InvokeServer is used for RemoteFunctions, instead, use :FireServer()

2 Likes
local Function = ReplicatedStorage:WaitForChild('Shared'):WaitForChild('Remotes'):WaitForChild('VehicleSystem')
local module = Function:InvokeServer({action = 'RequestInfo', type = typeDealer.Name})

So I’m assuming this still works if I do so by changing?

local module = Function:FireServer({action = 'RequestInfo', type = typeDealer.Name})

The second line should be changed (to FireServer) and everything should work.

How you have edited it is ok.

InvokeServer calls the callback of a RemoteFunction from the server and returns whatever the callback returns. You should be calling the FireServer method if you’re trying to call the OnServerEvent event of the RemoteEvent on the server. Note: RemoteEvents do not return any data from the event, they only call the connected function of the OnServerEvent event.

3 Likes

Hello, I love the placement system but have encountered a fatal error that I’m not sure how to fix.
“InvokeServer is not a valid member of RemoteEvent “ReplicatedStorage.remotes.requestPlacement” - Client - PlacementModuleV3:672”

Additionally, though not as vital, there seems to be an issue where it keeps blinking red periodically (maybe once or twice every second, keeping predominantly green). Not sure why that is either.

The grid bit works wonderfully though, at least!