I get this error: invalid argument #3 (string expected, got nil). These are the scripts:
Server script:
local rigs = game.Workspace.Rigs:GetChildren() local event = game.ReplicatedStorage.RigTouched for _, rig in pairs(rigs) do rig.OpenGuiPart.ClickDetector.MouseClick:Connect(function(player) local rigID = rig.ClothingID.Value event:FireClient(player, rigID) end) end
Local script:
local event = game.ReplicatedStorage.RigTouched local CurrentClothingID = script.Parent.ShopBackround.CurrentClothing event.OnClientEvent:Connect(function(player, rigId) script.Parent.ShopBackround.Visible = true CurrentClothingID.Value = rigId print(rigId) end)
I have read the code several times but still do not understand what is the problem. The error is on line 6 of the local script.
I see the mistake. You see, only OnServerEvent needs the player argument. OnClientEvent doesn't. So on the local script, do this instead:
local event = game.ReplicatedStorage.RigTouched local CurrentClothingID = script.Parent.ShopBackround.CurrentClothing event.OnClientEvent:Connect(function(rigID) script.Parent.ShopBackround.Visible = true CurrentClothingID.Value = rigId print(""..rigID) end)