I am working on a game that has a gui to select a team at the start of a game as well as a frame under the same parent in that gui. The team change buttons trigger the player to switch teams as well as make the teamchange frame not visible and classSelect frame visible. I also have a text box in my teamchange frame that displays how many players are on a team, but this shows up as the text that I have that isn't affected by code (so just "…"). All of the scripts are inside all the buttons and labels and the frames are inside a gui inside of startergui.
If it helps, here is the code inside of the teamchange button
local plr = script.Parent.Parent.Parent.Parent.Parent.Name script.Parent.MouseButton1Click:connect(function() game.Players[plr].TeamColor = BrickColor.new("Really red") game.Workspace[plr].Humanoid.Health = "0" wait(5) script.Parent.Parent.Visible = false script.Parent.Parent.Parent.ClassFrame.Visible = true script.Parent.Parent.Parent.ZoneWarning.Visible = true end)
local plr = game:GetService("Players").LocalPlayer script.Parent.MouseButton1Click:Connect(function() plr.TeamColor = BrickColor.new"Really red" plr.Character.Humanoid.Health = 0 end)
-- You can't access or operate guis using a server script. Use localscript and paste your old script --into the local script --[[ btw, incap is right. You don't need a ton of use of "parents" all the time. Define them using variables]] -- paste into localscript local plr = script.Parent.Parent.Parent.Parent.Parent.Name script.Parent.MouseButton1Click:connect(function() game.Players[plr].TeamColor = BrickColor.new("Really red") game.Workspace[plr].Humanoid.Health = "0" wait(5) script.Parent.Parent.Visible = false script.Parent.Parent.Parent.ClassFrame.Visible = true script.Parent.Parent.Parent.ZoneWarning.Visible = true end)
Have you tried turning it off and back on again?