Hi! I am making a player morph but when I change into the new character, the morph dies and resets to the original character. I noticed that this only took place when I changed the players character(plr.Character = newchar). Does anyone have any ideas on what I can do to fix it?
Server script –
game.ReplicatedStorage.Events.TelepLRParentchange.OnServerEvent:Connect(function(plr,OwnsGamepass)
local DadModel = game.ReplicatedStorage.ParentObjects.Models.Dad
if OwnsGamepass == true then
print("SERVEER OWNGAMEPASS")
local oldchar = plr.Character
local newchar = DadModel:Clone()
newchar.Parent = workspace
newchar.Name = plr.Name
local newscripts = game.ReplicatedStorage.RepGui.Prnt.Scripts:GetChildren()
newchar.HumanoidRootPart.CFrame = oldchar.HumanoidRootPart.CFrame * CFrame.new(0,5,0)
game.ReplicatedStorage.Events.TelepLRParentchange:FireAllClients(newchar)
for i,v in pairs(newscripts) do
v:Clone().Parent = newchar
print(v)
end
wait(0.37)
plr.Character = newchar
oldchar:Destroy()
end
end)
Client script–
local plr = game.Players.LocalPlayer
local hasPrntGamePass= game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId,28295603)
script.Parent.Activated:Connect(function()
if hasPrntGamePass then
print("CLIENT, PLR HAS PASS")
game.ReplicatedStorage.Events.TelepLRParentchange:FireServer(true)
end
end)
game.ReplicatedStorage.Events.TelepLRParentchange.OnClientEvent:Connect(function(newCHAR)
print("CLIENT REACHED")
print(newCHAR)
workspace.Camera.CameraSubject = newCHAR.Humanoid
end)