The problem I’m having is with my character not resetting after the reset, but it’s not that simple.
- ServerScript | ServerScriptService
local ServerStorage = game:GetService("ServerStorage")
local StarterPlayer = game:GetService("StarterPlayer")
local Teams = game:GetService("Teams")
local StarterCharacterScripts = StarterPlayer:WaitForChild("StarterCharacterScripts")
local CustomCharacters = ServerStorage:WaitForChild("CustomCharacters")
local StarterChildren = StarterCharacterScripts:GetChildren()
local GARspawn = game.Workspace.Outros.Spawn:WaitForChild("GAR").CFrame
local TrooperMorph = CustomCharacters:FindFirstChild("Trooper")
local SpecialistMorph = CustomCharacters:FindFirstChild("Specialist")
local CorporalMorph = CustomCharacters:FindFirstChild("Corporal")
local SergeantMorph = CustomCharacters:FindFirstChild("Sergeant")
local StaffSergeantMorph = CustomCharacters:FindFirstChild("StaffSergeant")
local MasterSergeantMorph = CustomCharacters:FindFirstChild("MasterSergeant")
local CommandSergeantMorph = CustomCharacters:FindFirstChild("CommandSergeantMajor")
local WarrantOfficerMorph = CustomCharacters:FindFirstChild("WarrantOfficer")
local UpperWarrantOfficerMorph = CustomCharacters:FindFirstChild("UpperWarrantOfficer")
local ChiefWarrantOfficerMorph = CustomCharacters:FindFirstChild("ChiefWarrantOfficer")
local EventFolder = game.Workspace.Outros.Eventos
local GAR = EventFolder:FindFirstChild("GAR")
-- Trooper & Specialist
GAR.OnServerEvent:Connect(function(player, itemName)
if itemName == "Trooper" then
player.Team = Teams.GAR
local NewCharacter = TrooperMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
if itemName == "Specialist" then
player.Team = Teams.GAR
local NewCharacter = SpecialistMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
end)
-- Corporal & Sergeant
GAR.OnServerEvent:Connect(function(player, itemName)
game.Players.CharacterAutoLoads = false
if itemName == "Corporal" then
player.Team = Teams.GAR
local NewCharacter = CorporalMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
if itemName == "Sergeant" then
player.Team = Teams.GAR
local NewCharacter = SergeantMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
end)
-- Staff Sergeant & Master Sergeant
GAR.OnServerEvent:Connect(function(player, itemName)
game.Players.CharacterAutoLoads = false
if itemName == "StaffSergeant" then
player.Team = Teams.GAR
local NewCharacter = StaffSergeantMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
if itemName == "MasterSergeant" then
player.Team = Teams.GAR
local NewCharacter = MasterSergeantMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
end)
-- Command Sergeant Mayor & Warrant Officer
GAR.OnServerEvent:Connect(function(player, itemName)
game.Players.CharacterAutoLoads = false
if itemName == "CommandSergeant" then
player.Team = Teams.GAR
local NewCharacter = CommandSergeantMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
if itemName == "WarrantOfficer" then
player.Team = Teams.GAR
local NewCharacter = WarrantOfficerMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
end)
-- Upper Warrant Officer & Chief Warrant Officer
GAR.OnServerEvent:Connect(function(player, itemName)
game.Players.CharacterAutoLoads = false
if itemName == "UpperWarrantOfficer" then
player.Team = Teams.GAR
local NewCharacter = UpperWarrantOfficerMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
if itemName == "ChiefWarrantOfficer" then
player.Team = Teams.GAR
local NewCharacter = ChiefWarrantOfficerMorph:Clone()
NewCharacter.Name = player.Name
for i, item in pairs(StarterChildren) do
item:Clone().Parent = NewCharacter
end
if player.Team == Teams.GAR then
NewCharacter.HumanoidRootPart.CFrame = GARspawn
end
player.Character = NewCharacter
NewCharacter.Parent = workspace
end
end)