Custom Character Apperance Loader not working on reset

This script is a character manager for my tower of god game
The only problem is that ive tried multiple things like hum.died task.delay(respawnTIme + 1), character added, etc i just need help at this point

task.wait()
local Tick = tick()
local Players = game:GetService("Players")
local SSS = game:GetService("ServerScriptService")

local DH = require(SSS:WaitForChild("Data").DataHandler.DataManager)
local RaceData = require(script.RaceData)


local LocalPlayer: Player = Players:GetPlayerFromCharacter(script.Parent)
local Character = script.Parent
local Hum: Humanoid = Character.Humanoid

repeat task.wait()
if Tick - tick() >= 10 then
	LocalPlayer:Kick("Failed to load in character manager")
end

until Character.IsLoaded.Value == true
local Profile = DH:GetPlayerData(LocalPlayer)
if not Profile then return end

local function LoadApperance()
	local BC: BodyColors = Character:WaitForChild("Body Colors")
	local Outfit = game.ServerStorage.Outfits:WaitForChild(Profile.Outfit)
	Character.Shirt:Destroy()
	Character.Pants:Destroy()
	Outfit.Shirt.Parent = Character
	Outfit.Pants.Parent = Character
	
	BC.HeadColor = RaceData[Profile.Race]["SkinTone"]
	BC.LeftArmColor = RaceData[Profile.Race]["SkinTone"]
	BC.LeftLegColor = RaceData[Profile.Race]["SkinTone"]
	BC.RightArmColor = RaceData[Profile.Race]["SkinTone"]
	BC.RightLegColor = RaceData[Profile.Race]["SkinTone"]
	BC.TorsoColor = RaceData[Profile.Race]["SkinTone"]
	
	local parts = Character:GetChildren()
	for i = 1, #parts do
		local instanceA = parts[i]
		if (instanceA.ClassName == "Accessory") then
			if not instanceA.Handle:FindFirstChild("HairAttachment") then
				parts[i]:Destroy()
			end
		end
	end
	
	if Profile.Weapon == "Katana" then
		local Katana = game.ServerStorage.WeaponModels.Katana:Clone()
		Katana.Parent = Character
		Katana["Main Black Handle"].Weld.Part0 = Character.Torso
		print("bakaaaa")
	end
	
end

if Profile.Race == "Goblin" then
	LoadApperance()
	print("Loaded")
end

Try putting it in StarterCharacterScripts. That causes the script to restart every time the character resets.

its in starter character scripts bro.

Can you put some console prints around the script to see where it fails?

there is, when i reset it doesnt print loaded again??? no errors

I see it at the end, but I mean put them throughout different parts of the script to see where it stops.

found the issue, it was with the repeat, just added a task.wait(1) at the top instead thanks

1 Like

Glad it worked. You could also try using Player.CharacterAppearanceLoaded:Wait()

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.