Hi everyone! I’ve gotten stuck with a thing I’m making.
The objective is simple. I’m trying to send 2 parameters thought a remote function and receive them.
The problem it’s that the first one (player) is getting duplicated and overwrites the second one. And I don’t know what might be the cause.
Here’s the code where I’m calling the remote function (from a local script)
--Equip an specific item (there's no need to check locally, the check will be made on server)
function TryEquipItem(itemName: string, itemType: string, guiFrame: Frame)
local itemsToWear = {
["Animation"] = nil,
["Skate"] = nil
}
if itemType == "Animation" then
itemsToWear.Animation = itemName
elseif itemType == "Skate" then
itemsToWear.Skate = itemName
end
--Check if the player owns the item and wear them
local result = SaveWearItems:InvokeServer(Players.LocalPlayer, itemsToWear)
if result == false then
return
end
local button = guiFrame.BarFrame["002-Buy-Equip-Button"]
guiFrame.BarFrame["001-CostLabel"].Text = "Equipped"
button.ModeValue.Value = "UnEquip"
button.Text = "UnEquip"
end
As you can see, the remote function is called below the second comment. If i print “itemsToWear” I get that data correctly.
This is where the remote function is being called:
--Try wearing the items a player owns from their inventory
--TODO Call it when a player character respawns too
function TrySaveWearing(player: Player, itemsToWear)
print(player, itemsToWear)
local result = DatabaseModule.TrySaveWearingItems(player, itemsToWear)
if result == true then
--TODO
else
return false
end
end
--Try to wear and save items for a player (callback)
SaveWearItems.OnServerInvoke = TrySaveWearing
The print of this second code returns 2 times the content of the player, instead of the player + itemsToWear dictionary:
I’m really stuck in this problem and I appreciate any help. Thanks