Well, I tried looking this up, but none of the other answers really had any useful responses.
I checked this out, but it didn’t help.
This is what is going on.
--Client
local LocalGetStats = RS:WaitForChild("LocalGetStats")
local function GetPlayerStats()
PlayerStats,MaxPlayerStats = LocalGetStats:InvokeServer()
end
local function GetChests(attempts)
if attempts == 30 then
warn("Attemps Exceeded Maximum Tries")
return
end
ChestPricesArray = GetChestPrices:InvokeServer()
Chests = ChestPricesArray
if ChestPricesArray == nil then
wait(1)
GetChests(attempts+1)
end
end
--Server
local LocalGetStats = Instance.new("RemoteFunction",RS)
LocalGetStats.Name = "LocalGetStats"
LocalGetStats.OnServerInvoke = function()
return PlayerStats,MaxPlayerStats
end
local GetChestPrices = Instance.new("RemoteFunction",RS)
GetChestPrices.Name = "GetChestPrices"
GetChestPrices.OnServerInvoke = function(plr,Chest)
return ChestPrice
end
--Ouput
--[[
Players.Improfized.PlayerGui.MobileShop:1344: attempt to index function with 'InvokeServer'
11:24:51.238 - Stack Begin
11:24:51.240 - Script 'Players.Improfized.PlayerGui.MobileShop', Line 1344 - function GetChestPrices
11:24:51.241 - Script 'Players.Improfized.PlayerGui.MobileShop', Line 1350 - function CreateCratesShop
11:24:51.241 - Script 'Players.Improfized.PlayerGui.MobileShop', Line 1903
11:24:51.242 - Stack End
]]```
I’m not sure but you might be trying to invoke the server before the server has even managed to create the remote function so maybe add a wait or WaitForChild before invoking the server
on one line above the errored line.
What does it print? If it prints a function, as I read the error, then check is the variable a RemoteFunction or not.
As what line it errored is ambiguous, this is far as I can help.
Based on the error I read, I can ensure this isn’t correct.
You never specified the GetChestPrices RemoteFunction in the LocalScript.
But if you did, you might’ve specified a function in the same script with the same name. Check for any functions with the name “GetChestPrices” in the LocalScript.
Example:
local function GetChestPrices()
--function code goes here
end