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

How do you set a team StarterCharacter?

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

1 comment

0

Use should use a code block, and you'd want to access the main Character instead the StaterCharacterScripts.

1 answer

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"

1 comment

0

I don't understand.

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