So I made a morph, and I'm trying to make an onClick GUI that will make a part called "anim" move. Since the part gets welded to the torso in the morph, if I do a regular CFrame it rotates with the torso, moving the whole player with it. So I made this script to do the touch, although it doesn't repeatable rotate, it just turns a little bit once and never does it again when the GUI is clicked. It would be great if you can tell me why this is happening and fix it.
local player = script.Parent.Parent.Parent.Parent.Parent
function onClick(mouse)
w1 = Instance.new("Weld")
w1.Parent = player.Character.Chest.anim
w1.Part0 = w1.Parent
w1.Part1 = player.Character.Torso
while true do
w1.C0.CFrame = w1.C0.Cframe * CFrame.fromEulerAnglesXYZ(0,1,0)
wait(0.1)
end
end
script.Parent.MouseButton1Down:connect(onClick)

1 comment
By the way, anim is inside the model called chest if you couldn't already tell.