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

How can I change the name and color of a team with a script?

Asked by 3 years ago

My script duplicates the default team and edits some properties, this works in the explorer, however, in game it shows that there is another white team called default.

here is my script:

local input = script.Parent
local button = input.Parent
local place = button.Parent.ScrollingFrame
local team = place.TextButton
local default = game.Teams.Default

button.MouseButton1Up:Connect(function()
    local addedteam = team:Clone()
    addedteam.Visible = true
    addedteam.Text = input.Text
    addedteam.Parent = place
    local teamteam = default:Clone()
    teamteam.Parent = game.Teams
    teamteam.Name = input.Text
    teamteam.TeamColor = BrickColor.new("Bright bluish green")
end)
0
Did you do all this in a local script? If so that might be the problem realchricrocgamer 15 — 3y
0
Also is there any errors in the output? realchricrocgamer 15 — 3y

1 answer

Log in to vote
1
Answered by
SynnDC 8
3 years ago
Edited 3 years ago

First I would start off saying that I did not make this script, ScriptLocalize did.

I recommend using this script as it works and is great to learn off of.

Link to the script: https://devforum.roblox.com/t/how-change-player-team-color-and-name

Make a script in ServerScriptService then insert this script inside the script:

local function guestTeamJoin(player)

    local guestTeam = Instance.new("Team")
    guestTeam.Parent = game:GetService("Teams")

    guestTeam.Name = "Guest"

    guestTeam.AutoAssignable = true
    guestTeam.TeamColor = BrickColor.new("Really red")

    player.Team = guestTeam

    local guestSpawnLocation = Instance.new("SpawnLocation")
    guestSpawnLocation.Parent = workspace
    guestSpawnLocation.Parent = game:GetService("Teams")

    guestSpawnLocation.BrickColor = BrickColor.new("Really red")
    guestSpawnLocation.Neutral = true
    guestSpawnLocation.TeamColor = BrickColor.new("Really red")
end

game.Players.PlayerAdded:Connect(guestTeamJoin)
Ad

Answer this question