Hello! I'm new to this site and i've came here after I can't understand why this won't work. Basically, what my script does is that when you click a screengui, the script will morph you into a set morph within the gui's parent. Maybe this screenshot will explain it better.
https://gyazo.com/87949704e9752be2a5ae7763f4515408
The gui itself looks like this. The gui that is supposed to morph the character is the archer gui.
https://gyazo.com/2c133542a4489ef0fcb8b438d76a9880
The code that morphs the player is
wait()
-- Variables
local sp = script.Parent
local reset = sp.ResetAppearance
local debounce = true
-- Functions
script.Parent.MouseButton1Click:connect(function(touched)
local body = sp.PartFolder:GetChildren()
local player = game.Players:GetPlayerFromCharacter(script.Parent)
if player and debounce == true then
debounce = false
if reset.Value == true then
local charparts = touched.Parent:GetChildren()
for i,v in pairs(charparts) do
if v:IsA("Hat") or v:IsA("Model") then
v:Destroy()
elseif v:IsA("BasePart") then
v.Transparency = 1
for i2,v2 in pairs(v:GetChildren()) do
if v2:IsA("Decal") then
v2:Destroy()
end
end
end
end
end
for i,v in pairs(body) do
local check = true
local checkchar = touched.Parent:GetChildren()
local checkparts = v:GetChildren()
for i2,v2 in pairs(checkchar) do
if v2.Name == v.Name then
check = false
end
end
local charpart = touched.Parent:findFirstChild(string.sub(v.Name,7,16))
if (#checkparts > 1 and check == true and charpart ~= nil) then
local bin = Instance.new("Model")
bin.Name = v.Name
bin.Parent = touched.Parent
local bodyclone = v:Clone()
bodyclone:SetPrimaryPartCFrame(CFrame.new())
local parts = bodyclone:GetChildren()
for i2,v2 in pairs(parts) do
if v2 ~= bodyclone.PrimaryPart then
v2.Anchored = false
v2.Parent = bin
local weld = Instance.new("ManualWeld")
weld.Parent = v2
weld.C0 = v2.CFrame
weld.Part0 = charpart
weld.C1 = CFrame.new()
weld.Part1 = v2
end
end
bodyclone:Destroy()
end
end
wait(0.5)
debounce = true
end
end)
I can't understand why this won't work, the output in the console is nothing. Help!

2 comments
aw mans
I'm assuming the script is inside of the player's character?