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