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

Help with team change gui?

Error: LoadChracter is not a valid member of Player

It works, I just get this error, and it makes me have to click it twice to respawn.

local clicker = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function()
    if clicker.TeamColor == BrickColor.new("Bright red") then
        clicker.TeamColor = BrickColor.new("Bright blue")
        clicker:LoadChracter()
    end
end)

1 answer

✓ Accepted answer

First problem player.TeamColor takes a BrickColor value not a string

BrickColor.new("Bright blue")

Second problem the parameters of MouseButton1Down are x, y not the player that clicks it.

MouseButton1Down should be used in a local script since so you can get the person who clicked with localplayer

local clicker = game.Players.LocalPlayer

Third problem Humanoid isn't in the player, it's in the character

local clicker = game.Players.LocalPlayer
local character = clicker.Character

Fixed code put together

local clicker = game.Players.LocalPlayer
local character = clicker.Character

script.Parent.MouseButton1Down:connect(function()
    if clicker.TeamColor == BrickColor.new("Bright blue") then
        clicker.TeamColor = BrickColor.new("Bright red")
        clicker.Humanoid.Health = 0
    end
end)

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