Issue: Body parts missing, except the head,hair. Issue 2: Camera stuck on sky, unable to move. Solution I tried: Testing one-by-one to find out which one is not working, turns out the SpawnScript caused the Issues.

So I require some help since my brain is dead now. Has no idea what to do.

game.Players.CharacterAutoLoads = false

for _, v in pairs(game.StarterGui:GetChildren()) do
	v.Parent = game.ReplicatedStorage.StarterGui
end

for _, v in pairs(game.StarterPack:GetChildren()) do
	v.Parent = game.ServerStorage.StarterPack
end

local function GetSpawns(player)
	local spawns = {}
	local function Get(obj)
		for _, v in pairs(obj:GetChildren()) do
			if v:IsA("SpawnLocation") then
				if player.Neutral and v.Neutral then
					table.insert(spawns, v)
				elseif player.TeamColor == v.TeamColor then
					table.insert(spawns, v)
				end
			else
				Get(v)
			end
		end
	end
	Get(game.Workspace)
	return spawns
end

local function LoadCharacter(player)
	player:LoadCharacter()
	player.Character:Destroy()
	local character = game.ServerStorage.Character:Clone()
	character.Name = player.Name
	character.Parent = game.Workspace
	local spawns = GetSpawns(player)
	if #spawns > 0 then
		character:MoveTo(spawns[math.random(#spawns)].Position)
	else
		character:MoveTo(Vector3.new(0, 30, 0))
	end
	
	player.Character = character
	
	for _, v in pairs(game.ServerStorage.StarterPack:GetChildren()) do
		v:Clone().Parent = player.Backpack
	end
	
	local ca = character.ChildAdded:connect(function(child)
		if child:IsA("Hat") then
			wait()
			local handle = child.Handle:Clone()
			handle.Name = "HAT - "..child.Name
			handle.Parent = character
			handle.Size = Vector3.new(0.2, 0.2, 0.2)
			handle.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0)
			local weld = Instance.new("Weld", handle)
			weld.Name = "HATT"
			weld.Part0 = character.Head
			weld.Part1 = handle
			weld.C0 = CFrame.new(0, character.Head.Size.Y / 2, 0)
			weld.C1 = child.AttachmentPoint
			
			child:ClearAllChildren()
end)

			child.Parent = handle
			child.Name = "Pos"
		end
	end)
	
	character.Humanoid.Died:wait()
	ca:disconnect()
	local p = character.LastHit.Value
	wait(5)
	LoadCharacter(player)
end

script.Respawn.Event:connect(function(player)
	LoadCharacter(player)
game.Players.PlayerAdded:connect(function(player)
	--repeat wait() until player and player.PlayerGui and player.Backpack
	LoadCharacter(player)
end)

2 comments

0

Are there any errors in the output?

0

No.