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

How do you set a team StarterCharacter?

Asked by 7 years ago

https://gyazo.com/5b329d02e6ca20a7d1014c0c54cbdd6e Thats a gif for some reason, none of the less it should show you what I'm trying to do a little better.

Code I'm using: local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr.TeamColor == BrickColor.new("Maroon") then game.StarterCharacter = game.StarterCharacter1 end local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr.TeamColor == BrickColor.new("Navy blue") then game.StarterCharacter = game.StarterCharacter2 end

0
Use should use a code block, and you'd want to access the main Character instead the StaterCharacterScripts. Crazycat4360 115 — 7y

1 answer

Log in to vote
0
Answered by
Lakodex 711 Moderation Voter
5 years ago
Edited 5 years ago
local rs = game.ReplicatedStorage
local defend = rs.CHARACTERNAMEHERE:Clone() --Put the name of the character in "CHARACTERNAMEHERE". And put the character in ReplicatedStorage
local plr = game.Players.LocalPlayer

if plr.Team == game.Teams.Chaos then
    wait()
    defend.Name = plr.Name
    plr.Character:Destroy()
    plr.Character = defend
    plr.Character.Parent = workspace
end

Here you Go. The only problem is that You need a NoRespawn script. Gotchu Covered. Also put the script inside a Localscript. andput it in "Startergui" or "StarterCharacterScripts"

local respawnTime = 99999999999999999999999999999999999999.9

local Players = game:GetService("Players")
Players.CharacterAutoLoads = false

Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:connect(function(Character)
        -- find the humanoid, and detect when it dies
        local Humanoid = Character:FindFirstChild("Humanoid")
        if Humanoid then
            Humanoid.Died:connect(function()
                -- delay, then respawn the character
                wait(respawnTime)
                Player:LoadCharacter()
            end)
        end
    end)

    Player:LoadCharacter() -- load the character for the first time
end)

Put this Script in a Script and Put it in "Workspace" or "ServerScriptStorage"

0
I don't understand. SerafimX454 0 — 5y
Ad

Answer this question