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