I'm trying to make a character select gui for an upcoming project of mine, but everytime I try to use one of the click functions, it doesn't work.
This is the script I originally had on my morph block:
And here it is for the gui:
--Put the Directory for the Morph Here--
local localmorph = game.ReplicatedStorage["Mario"]
local debounce = false
ChestPos = CFrame.new(0,0,0)
LeftArmPos = CFrame.new(0,-0.40,0)
RightArmPos = CFrame.new(0,-0.40,0)
LeftLegPos = CFrame.new(0,0.10,0)
RightLegPos = CFrame.new(0,0.10,0)
--Group Arms 1-2, Chest, and Legs 1-2 into a model, paste it into the server storage, then
--change the name above to coorespond with the model. (See Primid in ServerStorage for example)--
--im sorry this is so sloppy D:
--whoever made this should be sorry ~SFOH
-- ^^^^^^
function onClicked(hit)
if hit.Parent:findFirstChild("Humanoid") and debounce == false then
wait(.01)
debounce = true
if hit.Parent:findFirstChild("Torso") ~= nil then
--SAMUS GLITCH FIX -- you're welcome! ~SFOH
hit.Parent:findFirstChild("Torso").Anchored = true
if hit.Parent.Torso:FindFirstChild("Left Shoulder") and hit.Parent.Torso:FindFirstChild("Left Hip") and hit.Parent.Torso:FindFirstChild("Right Hip") and hit.Parent.Torso:FindFirstChild("Right Shoulder") then
local ls,rs,lh,rh=hit.Parent.Torso["Left Shoulder"],hit.Parent.Torso["Right Shoulder"],hit.Parent.Torso["Left Hip"],hit.Parent.Torso["Right Hip"]
ls.C0=CFrame.new(-1,.5,0)*CFrame.Angles(0,-math.pi/2,0)
ls.C1=CFrame.new(.5,.5,0)*CFrame.Angles(0,-math.pi/2,0)
rs.C0=CFrame.new(1,.5,0)*CFrame.Angles(0,math.pi/2,0)
rs.C1=CFrame.new(-.5,.5,0)*CFrame.Angles(0,math.pi/2,0)
lh.C0=CFrame.new(-1,-1,0)*CFrame.Angles(0,-math.pi/2,0)
lh.C1=CFrame.new(-.5,1,0)*CFrame.Angles(0,-math.pi/2,0)
rh.C0=CFrame.new(1,-1,0)*CFrame.Angles(0,math.pi/2,0)
rh.C1=CFrame.new(0.5,1,0)*CFrame.Angles(0,math.pi/2,0)
end
-----------------------
end
--destroy previous morph if found--
if hit.Parent:findFirstChild("Arm1") ~= anil then
hit.Parent:findFirstChild("Arm1"):Destroy()
end
wait(.01)
if hit.Parent:findFirstChild("Arm2") ~= nil then
hit.Parent:findFirstChild("Arm2"):Destroy()
end
wait(.01)
if hit.Parent:findFirstChild("Leg1") ~= nil then
hit.Parent:findFirstChild("Leg1"):Destroy()
end
wait(.01)
if hit.Parent:findFirstChild("Leg2") ~= nil then
hit.Parent:findFirstChild("Leg2"):Destroy()
end
wait(.01)
if hit.Parent:findFirstChild("Chest") ~= nil then
hit.Parent:findFirstChild("Chest"):Destroy()
end
wait()
--morph stuff--
if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Arm1") == nil and hit.Parent:FindFirstChild("Torso") and hit.Parent.Torso:FindFirstChild("Left Shoulder") then
local g = localmorph.Arm1:clone()
hit.Parent.Torso["Left Shoulder"].C0=hit.Parent.Torso["Left Shoulder"].C0*LeftArmPos
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i]:IsA("BasePart") then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent["Left Arm"]
Y.Part1 = g.Middle
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
end
if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Arm2") == nil and hit.Parent:FindFirstChild("Torso") and hit.Parent.Torso:FindFirstChild("Right Shoulder") then
local g = localmorph.Arm2:clone()
hit.Parent.Torso["Right Shoulder"].C0=hit.Parent.Torso["Right Shoulder"].C0*RightArmPos
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i]:IsA("BasePart") then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent["Right Arm"]
Y.Part1 = g.Middle
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Chest") == nil then
local g = localmorph.Chest:clone()
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "Part" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent.Torso
Y.Part1 = g.Middle
Y.C0 = ChestPos
Y.Parent = Y.Part0
end
for i=1, #C do
if C[i].className == "UnionOperation" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent.Torso
Y.Part1 = g.Middle
Y.C0 = ChestPos
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Leg1") == nil and hit.Parent:FindFirstChild("Torso") and hit.Parent.Torso:FindFirstChild("Left Hip") then
local g = localmorph.Leg1:clone()
hit.Parent.Torso["Left Hip"].C0=hit.Parent.Torso["Left Hip"].C0*LeftLegPos
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i]:IsA("BasePart") then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent["Left Leg"]
Y.Part1 = g.Middle
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
end
if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Leg2") == nil and hit.Parent:FindFirstChild("Torso") and hit.Parent.Torso:FindFirstChild("Right Hip") then
local g = localmorph.Leg2:clone()
hit.Parent.Torso["Right Hip"].C0=hit.Parent.Torso["Right Hip"].C0*RightLegPos
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i]:IsA("BasePart") then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent["Right Leg"]
Y.Part1 = g.Middle
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
--removing excess stuff-
local d = hit.Parent:GetChildren()
for i=1, #d do
if (d[i].className == "Hat") then
d[i]:Destroy()
end
end
if hit.Parent:findFirstChild("Head"):findFirstChild("face").Texture == nil then return end
hit.Parent:findFirstChild("Head"):findFirstChild("face").Texture="717dea9c5a1659640155f77c84892c " end
end
end
hit.Parent:findFirstChild("Head").Transparency = 1
hit.Parent:findFirstChild("Left Arm").Transparency = 1
hit.Parent:findFirstChild("Right Arm").Transparency = 1
hit.Parent:findFirstChild("Torso").Transparency = 1
hit.Parent:findFirstChild("Torso").Anchored = false
hit.Parent:findFirstChild("Left Leg").Transparency = 1
hit.Parent:findFirstChild("Right Leg").Transparency = 1
wait(1)
debounce = false
end
end
debounce=false--this script is total shite ~SFOH
end
script.Parent.MouseButton1Click:connect(onClicked)
Any help would be greatly appreciated

2 comments
I tried that and it's still not working. This is what I have for the function: function onClicked(hit)
Maybe you could get the local player in a local script then use a event and send it over to the main script.