Custom Team Characters - Roblox Scripting Tutorial

Publié le: 13 mai 2021
sur la chaîne: DevGabe
60,606
1k

Hey Guys! In today's video, I show you how to make custom team characters! This was heavily inspired by Emancyphur AKA Asians FTW:    / emancyphur  . Go check him out!

Time Stamps:
0:00 - Intro
0:32 - Asians FTW
1:14 - Preparing Setup
6:00 - Scripting Custom Characters On Spawn
24:10 - Reviewing Finished Script
25:20 - Testing Finished Script
27:25 - Outro

if you are still having problems with the camera stuck in the sky, here is a place file: https://www.roblox.com/games/10750529...
Click the 3 dots on this page, then click Edit.

Don't Forget to Like and Subscribe! Comment any suggestions! See you bros next time!

game.Players.CharacterAutoLoads = false

local CustomCharacters = game.ServerStorage:WaitForChild("CustomCharacters")
local StarterCharacterScripts = game.StarterPlayer.StarterCharacterScripts:GetChildren()

local RespawnTime = 3
local NeutralConnections = {}

local Red = game.Teams.Red
local Blue = game.Teams.Blue

-- Custom Character at Spawn Position
local RedSpawn = workspace:WaitForChild("RedSpawn").CFrame + Vector3.new(0, 5, 0)
local BlueSpawn = workspace:WaitForChild("BlueSpawn").CFrame + Vector3.new(0, 5, 0)

-- Spawn Character
local function OnSpawn(Player)
if not game.Players:FindFirstChild(tostring(Player)) then return end

local FindCharacter = CustomCharacters:FindFirstChild(tostring(Player.Team))
if FindCharacter then
-- Create Custom Character
local NewCharacter = FindCharacter:Clone()
NewCharacter.Name = Player.Name

for i, item in pairs(StarterCharacterScripts) do
item:Clone().Parent = NewCharacter
end

-- Spawn Positions
if Player.Team == Red then
NewCharacter.HumanoidRootPart.CFrame = RedSpawn
elseif Player.Team == Blue then
NewCharacter.HumanoidRootPart.CFrame = BlueSpawn
end

Player.Character = NewCharacter

NewCharacter.Parent = workspace

else
-- Default Avatar
Player:LoadCharacter()

if Player.Neutral then
-- Detect if Team Changes When Neutral
NeutralConnections[Player] = Player:GetPropertyChangedSignal("Team"):Connect(function()
NeutralConnections[Player]:Disconnect()
OnSpawn(Player)
end)
end
end
end

-- Player is First Added in Game
local function FirstAdd(Player)
-- Listen to Character Death -- Respawn
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Died:Connect(function()
wait(RespawnTime)
OnSpawn(Player)
end)
end)
OnSpawn(Player) -- First Character spawn
end
game.Players.PlayerAdded:Connect(FirstAdd)

-- Detect if Team Player Removed
for i, team in pairs(game.Teams:GetTeams()) do
team.PlayerRemoved:Connect(OnSpawn)
end


Sur cette page du site, vous pouvez voir la vidéo en ligne Custom Team Characters - Roblox Scripting Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur DevGabe 13 mai 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 60,606 fois et il a aimé 1 mille téléspectateurs. Bon visionnage!