Server dictonary not same as client dictonary when sent over only on mobile

I working on a game with a level select the way it works is client asks for its player data dictonary with a Remotefunction from the server then it creates the gui depending on the dictonary of data

The problem is that on the server it sends over a dictonary with 17 elemnts

That look like this
{
		
	PlayerOnLevel = 0;
	
	["1"] = {ImageId = "http://www.roblox.com/asset/?id=8062553122", Unlocked = true, Difficulty = Easy,
		Tip = "Press C or tap the flag icon to put down a checkpoint for the ball and each level got a max"};
	["2"] = {ImageId = "", Unlocked = false, Difficulty = Easy, 
		Tip = ""};
	["3"] = {ImageId = "", Unlocked = false, Difficulty = Easy, 
		Tip = ""};
	["4"] = {ImageId = "", Unlocked = false, Difficulty = Easy, 
		Tip = ""};
	["5"] = {ImageId = "", Unlocked = false, Difficulty = Easy, 
		Tip = ""};
	["6"] = {ImageId = "http://www.roblox.com/asset/?id=8062546001", Unlocked = true, Difficulty = Meduim, 
		Tip = ""};
	["7"] = {ImageId = "", Unlocked = false, Difficulty = Meduim, 
		Tip = ""};
	["8"] = {ImageId = "", Unlocked = false, Difficulty = Meduim, 
		Tip = ""};
	["9"] = {ImageId = "", Unlocked = false, Difficulty = Meduim, 
		Tip = ""};
	["10"] = {ImageId = "", Unlocked = false, Difficulty = Meduim, 
		Tip = ""};
	["11"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
		Tip = ""};
	["12"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
		Tip = ""};
	["13"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
		Tip = ""};
	["14"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
		Tip = ""};
	["15"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
		Tip = ""};
	["16"] = {ImageId = "", Unlocked = false, Difficulty = Boss, 
		Tip = ""};
		
	}

but the client gets just the elements 1 and 8 and nothing eles just those two enterys

the thing is that this only happens on mobile and not on pc
and I have no idea what I should do now

any help is highlly appriciated

1 Like

Need to see code to assess problem

1 Like

these function are inside of a module and GetPlayerDataAndSaveToList is set off when a player join and GetPlayerLevels is set off when client invokes the server

Module Code
function Levels.GetPlayerDataAndSaveToList (Player)
	
	local Easy = "Easy"
	local Meduim = "Meduim"
	local Hard = "Hard"
	local Boss = "Boss"
	
	-- Edit: Removed my comments for stuff in future
	
players
	local NewPlayerData = {
		
		PlayerOnLevel = 0;
		
		["1"] = {ImageId = "http://www.roblox.com/asset/?id=8062553122", Unlocked = true, Difficulty = Easy,
		Tip = "Press C or click the flag icon to put down a checkpoint for the ball and each level got a max"};
		["2"] = {ImageId = "", Unlocked = false, Difficulty = Easy, 
		Tip = ""};
		["3"] = {ImageId = "", Unlocked = false, Difficulty = Easy, 
			Tip = ""};
		["4"] = {ImageId = "", Unlocked = false, Difficulty = Easy, 
			Tip = ""};
		["5"] = {ImageId = "", Unlocked = false, Difficulty = Easy, 
			Tip = ""};
		["6"] = {ImageId = "http://www.roblox.com/asset/?id=8062546001", Unlocked = true, Difficulty = Meduim, 
			Tip = ""};
		["7"] = {ImageId = "", Unlocked = false, Difficulty = Meduim, 
			Tip = ""};
		["8"] = {ImageId = "", Unlocked = false, Difficulty = Meduim, 
			Tip = ""};
		["9"] = {ImageId = "", Unlocked = false, Difficulty = Meduim, 
			Tip = ""};
		["10"] = {ImageId = "", Unlocked = false, Difficulty = Meduim, 
			Tip = ""};
		["11"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
			Tip = ""};
		["12"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
			Tip = ""};
		["13"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
			Tip = ""};
		["14"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
			Tip = ""};
		["15"] = {ImageId = "", Unlocked = false, Difficulty = Hard, 
			Tip = ""};
		["16"] = {ImageId = "", Unlocked = false, Difficulty = Boss, 
			Tip = ""};
		
	}
	
	Levels.SavedPlayerData[Player] = NewPlayerData
end

function Levels.GetPlayerLevels (Player)
	
	return Levels.SavedPlayerData[Player]
end

heres the code of the server

local LevelModule = require(game.ServerStorage:WaitForChild("Modules"):WaitForChild("LevelModule"))

LevelTeleportEvent.OnServerEvent:Connect(LevelModule.SendPlayerToLevel)
GetLevelsFromServer.OnServerInvoke = LevelModule.GetPlayerLevels

the client just invokes the server

local GetLevelsFromServer = script.Parent:WaitForChild("GetLevels")
local PlayerLevelsTable = GetLevelsFromServer:InvokeServer()

Try putting PlayerOnLevel in brackets and quotes

local LevelModule = require(game.ServerStorage:WaitForChild("Modules"):WaitForChild("LevelModule"))

LevelTeleportEvent.OnServerEvent:Connect(LevelModule.SendPlayerToLevel)
GetLevelsFromServer.OnServerInvoke = LevelModule.["GetPlayerLevels"]

like this? I mean it alredy was doing what the function intended it just wasent the same on the client but I`ll try it

No I said PlayerOnLevel

OH ok I`ll do that just a second

It didnt change anything still just showin 1 and 8 EDIT: nvm it sent over the PlayerOnLevel as well

Send the rest of the module code there is code missing in what you posted before

Also can I see screenshot of the print output

why all those other functions werent used and dont do anything to the player data

and for screenshot of the output I cant cuz it on tablet the bug dosent work on pc even on emulator

GetPlayerLevels returns the return of a function I can’t see the code of

it returns it to the client invoke
Edit: relized what you meant but the SavedPlayerData is just a list inside the module

I see.

Can you screenshot on ipad please. Press power off and volume down or power off and home button

Do print() and expand the results

Oh ya forgot about that gonna do it rn

Also are you sure GetPlayerDataAndSaveToList runs before you send the data to the client?

Absolutelly the player first needs to jump inside a hole to even ask for the dictonary and even if he manages to go in before the save data function it should print out nil

Hmm.

Just in case there is a race condition do

OnServerInvoke:Connect(function(player)

    if list[player] ~= nil then
       return list[player]
    else
       return GetPlayerDataAndSaveToList
    end

end)

Also when the screenshot coming in

also I’m on phone, writing that code was tedious. Don’t make me write anymore code on phone

it`s comin and sorry for making you write the code

1 Like

and that cheese was just to see if i was on latest version it was printed out of another client script

Also send the print code