You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to make a morph system, to achieve it, I simply change the player’s character into a custom rigged model. However, when I do this, the player’s guis and scripts dissappear. -
What is the issue? Include screenshots / videos if possible!
The morphed model–animations and everything-- work perfectly, however, when I actually change the player.Character into the model, the playerGui and playerScripts dissappear sometimes for some reason… (yes the morph is on the server) -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve looked up multiple solutions online, on the developer hub, scriptinghelpers, hiddendevs, but I haven’t found anything that helped me with my situation… Please help me.
Here’s some extra information that may help you find the issue.
This is the RIG i’m trying to morph into.
Here is my morph script on the server.
--local characterGui = game.ReplicatedStorage.Character
function ChangeBody(OldBody,NewBody)
OldBody.Humanoid:RemoveAccessories()
if OldBody.Head:FindFirstChild("face") then
OldBody.Head.face:Destroy()
end
local BodyParts={'Head',['Chest']='Torso',['Arm1']='Left Arm',['Arm2']='Right Arm',['Leg1']='Left Leg',['Leg2']='Right Leg'}
for i,v in pairs(BodyParts)do
OldBody[v].Transparency=1
if v~='Head'then
local BodyPart=NewBody[i]:Clone()
BodyPart.Parent=OldBody
local Middle=BodyPart:FindFirstChild('Middle')
for z,b in pairs(BodyPart:GetDescendants())do
if b:IsA('BasePart')then
b.CanCollide=false
b.Anchored=false
if b~=Middle then
local W=Instance.new('Weld')
W.Part0=Middle
W.Part1=b
local CJ=CFrame.new(Middle.Position)
W.C0=Middle.CFrame:inverse()*CJ
W.C1=b.CFrame:inverse()*CJ
W.Parent=Middle
end
end
end
local W=Instance.new('Weld')
W.Part0=OldBody[v]
W.Part1=Middle
W.C0=CFrame.new(0,0,0)
W.Parent=W.Part0
end
end
end
function riggedMorph(plr, oldchar, morphchar)
local newchar = morphchar:Clone()
newchar.Name = plr.Name
newchar:SetPrimaryPartCFrame(oldchar.PrimaryPart.CFrame)
oldchar:Destroy()
plr.Character = newchar
newchar.Parent = workspace
end
function sendToSpawn(plr, hors)
if hors == "Hero" then
local Spawns = game.Workspace.Spawns:GetChildren()
local char = plr.Character or plr.CharacterAdded:Wait()
local RandomSpawn = Spawns[math.random(1, #Spawns)]
char.HumanoidRootPart.CFrame = RandomSpawn.CFrame
--CharacterGui:Clone().Parent = plr.PlayerGui
elseif hors == "Slasher" then
--CharacterGui:Clone().Parent = plr.PlayerGui
end
end
game.ReplicatedStorage.Morph.OnServerEvent:Connect(function(plr, HORS, v)
if game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name) then
if game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("Configuration") and game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("Model") and game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("Model"):FindFirstChildWhichIsA("Model") then
print("morph")
if plr.leaderstats.G.Value >= game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Gold.Value then
plr.leaderstats.G.Value -= game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Gold.Value
ChangeBody(plr.Character, game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Model:FindFirstChildWhichIsA("Model"))
sendToSpawn(plr, HORS)
plr.Character.Humanoid.WalkSpeed = game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Walkspeed.Value
plr.Character.Humanoid.JumpPower = game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Jump.Value
--characterGui:Clone().Parent = plr.PlayerGui
if game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration:FindFirstChild("Weapons") then
for i,v in pairs(game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration:FindFirstChild("Weapons"):GetChildren()) do
if v:IsA("Tool") then
wait(5)
local weaponClone = v:Clone()
weaponClone.Parent = plr.Backpack
end
end
end
end
elseif game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("Configuration") and game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("RiggedModel"):FindFirstChildWhichIsA("Model") then
print("riggedmorph")
if plr.leaderstats.G.Value >= game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Gold.Value then
plr.leaderstats.G.Value -= game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Gold.Value
riggedMorph(plr, plr.Character, game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name):FindFirstChild("RiggedModel"):FindFirstChildWhichIsA("Model"))
plr.Character.Humanoid.WalkSpeed = game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Walkspeed.Value
plr.Character.Humanoid.JumpPower = game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration.Jump.Value
--characterGui:Clone().Parent = plr.PlayerGui
if game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration:FindFirstChild("Weapons") then
for i,v in pairs(game.ReplicatedStorage.Characters[HORS]:FindFirstChild(v.Name).Configuration:FindFirstChild("Weapons"):GetChildren()) do
if v:IsA("Tool") then
local weaponClone = v:Clone()
weaponClone.Parent = plr.Backpack
end
end
end
end
end
end
end)
if true then
elseif false then
end
I have different functions for folders called RiggedModel and folders just called Model, but both of them have this issue for some reason. On the client the Morph RemoteEvent is only called when a player clicks a button on the character selection gui. The folders it looks through are setup like this:
(both hero and slasher are the same)
The rig just looks like this generally
I use a plugin I made called UniqueRenamer (dont ask me why the number goes so high)
And yes I’m aware animations are supposed to be done on the client, I’m just testing some stuff right now.
Anyways, thats all the info you should know. Please help with this and thank you in advance.