I know that there are plenty of well-documented custom morph scripts around but I just can’t seam to get any of them to work for me in my specific script. Part of it is probably lack of sleep as I have made these before, but as of now this is all I could come up with, which isn’t really practical as using a while true statement lags out the game and has a delay as you need to use wait( )
. Nevertheless, here’s what I am using and I need to know what a better solution would be.
Section that controls the morph:
local headClone = adMorph.Hair:Clone()
while suitshow == true do
wait(0.01)
headClone.Parent = player.Character.Head
headClone:FindFirstChild('Middle').CFrame = player.Character:FindFirstChild('Head').CFrame
end
Entire Script:
local player = game.Players:GetPlayerFromCharacter(script.Parent)
local charecter = player.Character
local gr = player:GetRankInGroup(7067077)
local Humanoid = player.Character.Humanoid
local accessories = Humanoid:GetAccessories()
local adMorph = game.ReplicatedStorage.Morphs["Administrative Department"]:FindFirstChild('Administrative')
local pClothes = Instance.new('Folder')
pClothes.Name = 'pClothes'
pClothes.Parent = game.ServerStorage
print(accessories)
player.Chatted:connect(function(msg)
if gr >= 13 then
msg=msg:lower()
if (msg == "!suitshow") then
local suitshow = true
charecter:FindFirstChild("Shirt").Parent = pClothes
charecter:FindFirstChild("Pants").Parent = pClothes
local shirtClone = adMorph.Suit.mShirt:Clone()
shirtClone.Parent = charecter
local pantsClone = adMorph.Suit.mPants:Clone()
pantsClone.Parent = charecter
local headClone = adMorph.Hair:Clone()
while suitshow == true do
wait(0.01)
headClone.Parent = player.Character.Head
headClone:FindFirstChild('Middle').CFrame = player.Character:FindFirstChild('Head').CFrame
end
for i,v in pairs(accessories) do
if v:IsA("Accessory") then
print('IsAccesory')
if v.AccessoryType == 'Face' then
print('IsAFaceFrontAccesory')
v.Parent = pClothes
print("accessories moved to SS")
end
end
end
print('Suit Shown')
end
if (msg == "!suithide") then
for i,v in pairs(pClothes:GetDescendants()) do
if v:IsA("Accessory") then
v.Parent = player.Character
end
end
pClothes:FindFirstChild("Shirt").Parent = player.Character
pClothes:FindFirstChild("Pants").Parent = player.Character
player.Character.mShirt:Destroy()
player.Character.mPants:Destroy()
print('Suit Hid')
end
end
end)