RemotesFunction Doesn't work

I think i ever met this Problem but it on RemotesEvent and this problem got fixed by I did script in new Place
but it doesn’t work for this can someone fix this

So The problem is nothing happend after Invokeserver

Client:

local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local RemoteFunction = RS:WaitForChild("InventoryRemote")

local OpenInventoryBtn = script.Parent
local InventoryUI = OpenInventoryBtn.Parent.Inventory

local ItemUi = RS:WaitForChild("Ui"):WaitForChild("ItemUI")

OpenInventoryBtn.MouseButton1Click:Connect(function()
	InventoryUI.Visible = not InventoryUI.Visible
	local Result = RemoteFunction:InvokeServer(LocalPlayer)
	print(Result)
	if Result then
		for i,v in (Result) do
			local NewUi = ItemUi:Clone()
			NewUi.Text = v
			NewUi.Parent = InventoryUI
			print("test")
		end
	end

end)

Server:

local Inventory = {}

local RS = game:GetService("ReplicatedStorage")
local RemoteFunction = RS:WaitForChild("InventoryRemote")

RemoteFunction.OnServerInvoke = function(plr)
	if not Inventory[plr] then
		Inventory[plr] = {}
	end
	
	table.insert(Inventory[plr] , "apple")
	print(Inventory)
	return Inventory[plr]
end
1 Like

Do you get output from the console on the client side saying the result which is the player table and not nil

1 Like

Try adding the Keyword pairs in the for loop or removing the brackets of the result.Im pretty sure thats the only other solution maybe as i know you can now skip using pairs and ipairs.

There is nothing in output

Use print statements to debug, check if the RemoteFunction is running and returning data properly.

Thats weird that means your whole local script isnt working can you show a screenshot of if the button actually works

put it in serverscript service it will do wonders

Thanks yall for help me, now i found problem
I need to change RunContext in property to server

image