Recently had this Item Storage GUI when I encountered an error! The error occurs when I click the 4th slot on the GUI which you should see in the code.
The Error I Get Players.ELITE_PUGS.PlayerGui.Bank.Bank.LocalScript:24: invalid argument #3 (string expected, got nil)
Server Script
-- Services -- local Replicated = game:GetService("ReplicatedStorage") local dataStore = game:GetService("DataStoreService") local ServerStorage = game:GetService("ServerStorage") -- DataStores -- local DS2 = require(1936396537); DS2.Combine("DATA", "Bank") -- Scripting -- local DEBOUNCES = { } Replicated[script.Name].OnServerEvent:Connect(function(Player, Slot, retrieveName) if (typeof(Slot) ~= "number" or Slot > 4) then return; end local playerKey = tostring(Player.UserId) .."_Bank" local playerStore = DS2("Bank", Player) local playerBase = playerStore:Get({ [1] = "Empty Slot"; [2] = "Empty Slot"; [3] = "Empty Slot"; [4] = "Empty Mom"; }); if (not retrieveName) then if (DEBOUNCES[Player.Name]) then return; end DEBOUNCES[Player.Name] = true if (playerBase[Slot] == "Empty Slot") then local ITEM = Player.Character:FindFirstChildOfClass("Tool"); if (not ITEM) then Replicated[script.Name]:FireClient(Player, Slot, "Read instructions!") wait(1) Replicated[script.Name]:FireClient(Player, Slot, playerBase[Slot]) elseif (ITEM) then playerBase[Slot] = ITEM.Name; ITEM:Destroy() Replicated[script.Name]:FireClient(Player, Slot, playerBase[Slot]) playerStore:Set(playerBase) end else local ITEM = ServerStorage:FindFirstChild(playerBase[Slot]) if (ITEM) then local CLONE = ITEM:Clone() CLONE.Parent = Player.Backpack end playerBase[Slot] = "Empty Slot"; Replicated[script.Name]:FireClient(Player, Slot, playerBase[Slot]) playerStore:Set(playerBase) end DEBOUNCES[Player.Name] = false elseif (retrieveName) then Replicated[script.Name]:FireClient(Player, tostring(Slot), playerBase[Slot]) end end)
Local Script in GUI
-- Services -- local Replicated = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") -- LocalPlayer -- local Player = Players.LocalPlayer -- Scripting -- for _, b in pairs(script.Parent:GetChildren()) do coroutine.resume(coroutine.create(function() if (b:IsA("TextButton")) then Replicated["Bank"]:FireServer(tonumber(b.Name), true) b.MouseButton1Click:Connect(function() Replicated["Bank"]:FireServer(tonumber(b.Name), false) end) end end)) end Replicated["Bank"].OnClientEvent:Connect(function(Slot, Text) script.Parent[Slot].Text = Text; -- Error = Players.ELITE_PUGS.PlayerGui.Bank.Bank.LocalScript:24: invalid argument #3 (string expected, got nil) end)