So I have a problem right now because whenever I try to use certain buttons in my gui, it will have an error printed out in the Developer Consoles saying: ServerScriptService.IHelpSadLocalScripts:10: bad argument #2 (string expected, got Object) and then it happens at line 10.
Also, there is the same exact error but on line 5, line 20, and line 26. This is my code:
game.ReplicatedStorage.moneyevent.OnServerEvent:Connect(function(player,asd,amount) game.ServerStorage.MoneyStorage[asd].Value = amount end) game.ReplicatedStorage.tempgui.OnServerEvent:Connect(function(player,asd) game.Players[asd].admingui.Contents.Visible = true game.Players[asd].admingui.Border1.Visible = true game.Players[asd].admingui.TempClose.Visible = true end) game.ReplicatedStorage.giveitem.OnServerEvent:Connect(function(player,asd,itemid,amount) game.ServerStorage.AwardItem:Invoke(game.Players[asd],itemid,amount) end) game.ReplicatedStorage.clearcrate.OnServerEvent:Connect(function(player,cratetype) for i,v in pairs(workspace:GetChildren()) do if v.Name == cratetype then v:Destroy() end end end) game.ReplicatedStorage.ucevent.OnServerEvent:Connect(function(player,asd,amount) game.Players[asd].Crystals.Value = amount end) game.ReplicatedStorage.crateevent.OnServerEvent:Connect(function(player,asd,cratetype,amount) game.ServerStorage[cratetype]:Clone().Parent = workspace workspace[cratetype].Position = workspace[asd].HumanoidRootPart.Position workspace[cratetype].Position = workspace[cratetype].Position + Vector3.new(20,0,0) local x = 0 local y = amount while x < y do workspace[cratetype]:Clone().Parent = workspace x = x + 1 end end) game.ReplicatedStorage.boxevent.OnServerEvent:Connect(function(player,asd,boxtype,amount) game.Players[asd].Crates[boxtype].Value = amount end)
Thanks for helping. -- Nevermind, I fixed it myself long ago.
Clearly the problem (and something I've seen in common) in all the error lines is this [asd]
input. Check to see if those things are correct, and tell me more information about what [asd]
is, and I might be able to explain it to you a little more in-depth.
(Update)
You're trying to access the admin gui, but with Screen Gui's you have to go through the player GUI and I believe this is a local script.
local plr = game:GetService('Players').LocalPlayer game.ReplicatedStorage.moneyevent.OnServerEvent:Connect(function(asd,amount) game.ServerStorage.MoneyStorage[asd].Value = amount end) game.ReplicatedStorage.tempgui.OnServerEvent:Connect(function(asd) plr.PlayerGui.admingui.Contents.Visible = true plr.PlayerGui.admingui.Border1.Visible = true plr.PlayerGui.admingui.TempClose.Visible = true end) game.ReplicatedStorage.giveitem.OnServerEvent:Connect(function(asd,itemid,amount) game.ServerStorage.AwardItem:Invoke(itemid,amount) end) game.ReplicatedStorage.clearcrate.OnServerEvent:Connect(function(cratetype) for i,v in pairs(workspace:GetChildren()) do if v.Name == cratetype then v:Destroy() end end end) game.ReplicatedStorage.ucevent.OnServerEvent:Connect(function(asd,amount) plr.Crystals.Value = amount end) game.ReplicatedStorage.crateevent.OnServerEvent:Connect(function(asd,cratetype,amount) game.ServerStorage[cratetype]:Clone().Parent = workspace workspace[cratetype].Position = workspace[asd].HumanoidRootPart.Position workspace[cratetype].Position = workspace[cratetype].Position + Vector3.new(20,0,0) local x = 0 local y = amount while x < y do workspace[cratetype]:Clone().Parent = workspace x = x + 1 end end) game.ReplicatedStorage.boxevent.OnServerEvent:Connect(function(asd,boxtype,amount) plr.Crates[boxtype].Value = amount end)
By the way, you don't have to put in player because when the event is fired, player is already sent in to the server script or other script, you just have to define it on the script it's firing to.