i have a serverscript that changes the character of the player when they choose the character. it works but the only issue is that it reloads the gui thats open and the sound thats being played
local so = game.ReplicatedStorage:WaitForChild('SaveOutfit')
local function changeChar(player, outfit, introMusic, timepos)
local oldChar = player.Character
local newChar = game.ReplicatedStorage:FindFirstChild(outfit)
local character
if newChar then
character = newChar:Clone()
end
local animations = oldChar.Animate:Clone()
if outfit == 'custom' then
player:LoadCharacter()
end
animations.Parent = character
character.Name = player.Name
player.Character = character
character.HumanoidRootPart.CFrame = oldChar.HumanoidRootPart.CFrame
character.Parent = workspace
oldChar:Destroy()
introMusic.TimePosition = timepos --tried this to not reset the sound but didnt work
end
so.OnServerEvent:Connect(changeChar)
if anyone can help me then i will appreciate it, and ty for reading!
