So I have a Gui that when clicked it should only open for a team called Adult All the Main assets were put in different names, but what I'm saying is that there are 5 errors after each other and I have no idea of what to do or what went wrong nothing is said in the output, or the developer. So I'm really really confused about what went wrong.
---Script---
local frame = script.Parent.Parent.Frame2 local open = false local others = Teams.Kid local others = Teams.Teenager local others = Teams.Pet local Person = Playes.Player local Main = Teams.Adult script.Parent.MouseButton1Click:Connect(function() if Person.Team == Main then frame.Visible = true elseif Person.Player.Team == others then frame.Visible = false end end)
---Errors---
local frame = script.Parent.Parent.Frame2 local open = false local others = Teams.Kid ---Error local others = Teams.Teenager ---Error local others = Teams.Pet ---Error local Person = Playes.Player ---Error local Main = Teams.Adult ---Error script.Parent.MouseButton1Click:Connect(function() if Person.Team == Main then frame.Visible = true elseif Person.Player.Team == others then frame.Visible = false end end)
---Proof of Error--- https://gyazo.com/adea1a53ca8b6476826ec67b997fca6e
To avoid the error, say game.Teams instead of Teams. Also, to reference the player, say "game.Players.LocalPlayer"
I explained tables to you in the chat but if you need anymore explanation let me know
local frame = script.Parent.Parent.Frame2 local isOpen = false --table of all the teams... --equivalent to saying: --teams = { game.Teams.Adult, game.Teams.Kid, game.Teams.Teenager, game.Teams.Pet } teams = game.Teams:GetChildren() --gets a reference to the player player = game.Players.LocalPlayer local defaultTeam = game.Teams.Adult script.Parent.MouseButton1Click:Connect(function() if player.Team == defaultTeam then frame.Visible = true elseif player.Team == others then frame.Visible = false end end)
local frame = script.Parent.Parent.Frame2 local open = false local others = game.Teams.Kid local others = game.Teams.Teenager local others = game.Teams.Pet local Person = game.Players.Player local Main = game.Teams.Adult script.Parent.MouseButton1Click:Connect(function() if Person.Team == Main then frame.Visible = true elseif Person.Player.Team == others then frame.Visible = false end end)
Try this. It said there was no errors in mine. I think I might have known the problem. You forgot to put game before ".Teams.", instead, you did "local others = Teams.Pet". Let me know for any issues.