I made a gui with a textbutton that is supposed to switch teams and have different text based off of what team you're on but it only works in studio and I don't know any better way to do what I'm trying to do.
Link to place:(http://www.roblox.com/games/336021906/ScriptBox)
Script:
--By MrDefaultMan
--Declaring Variables
local team1 = game.Teams.Hub
local team2 = game.Teams.Training
dud = game.Players.LocalPlayer
local green = Color3.new(0, 170, 0)
huh = dud.Character:FindFirstChild('Humanoid')
if dud.TeamColor == BrickColor.new('Medium stone grey') then --if ur in Training the text is "back to hub"
script.Parent.Text = "back to hub"
end
if dud.TeamColor == BrickColor.new('Ghost grey') then --if ur in Hub the text is "to training"
script.Parent.Text = "to training"
end
script.Parent.MouseButton1Down:connect(function(click) --Changes teams
if script.Parent.Text == "back to hub" then
huh.Health = 0
dud.TeamColor = BrickColor.new('Ghost grey')
end
if script.Parent.Text == "to training" then
huh.Health = 0
dud.TeamColor = BrickColor.new('Medium stone grey')
end
end)

2 comments
Oh the green variable has something to do with another gui that should not be in the script because it means nothing ignore it.
line 8 should wait for the character; huh=(dud.Character or dud.CharacterAdded:wait()):FindFirstChild("Humanoid")