Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a button only visible for a certain team?

I am making a training center for my game. There will be 3 teams, Trainee (white) Staff (Medium blue) and host (black). I want the host to have a button that nobody else can access. Here is my script:

local Players = game:GetService("Players").LocalPlayer
if Players.Teams.TeamColor == (Players.Teams.TeamColor == "Black") then
    game.StarterGui.ScreenGui.TextButton.Visible = true
    else
        game.StarterGui.ScreenGui.TextButton.Visible = false
end

1 answer

I just figured out an easier way, it is visible to everyone but only the certain team can use it. Here is the script if anyone else needs it.

local frame = script.Parent.Parent.Frame
    local open = false
    local others = game.Teams.Trainee
    local others = game.Teams.Staff
    local Person = game.Players.LocalPlayer
    local Main = game.Teams.Host

	frame.Visible = false
    script.Parent.MouseButton1Click:Connect(function()
        if Person.Team == Main then
            frame.Visible = true
        elseif
            Person.Team == others then
                frame.Visible = false
    script.Parent.Text = "Not right team."
    wait(1)
    script.Parent.Text = "Open Host Gui"
        end
    end)

This discussion is preserved as it was. New answers, comments, and votes are closed.