Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

This question has been solved by the original poster.

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
Ad

Answer this question