Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is wrong with this cFrame animation?

Asked by 8 years ago

The cFrame works and everything but whenever I subtract the animation it looks weird.

Here is the code:

Player = script.Parent.Parent
mouse = Player:GetMouse()
run = game:GetService("RunService")

a2 = Player.Character.Torso["Right Shoulder"]
function onKeyDown(key)
key = key:lower()
if key == "z" then
Run = game:GetService("RunService")
for loop = 1,16 do
a2.C0 = a2.C0 *CFrame.Angles(0,0.05,0.1)
Run.Stepped:wait(0.025)
end
for loop = 1,16 do
a2.C0 = a2.C0 *CFrame.Angles(0,-0.05,-0.1)
Run.Stepped:wait(0.025)
end
end
end
mouse.KeyDown:connect(onKeyDown)

Image from after pressing Z: Image1 Image from after pressing Z tons of times Image2

Answer this question