Upon my scripting on a gun (which i have never done before), i met various of situations,errors and bugs which took me hours to resolve and not like the others, i'm still not very confident on what i have done: Not really used and trained on using loops and such, but i attemped to make an animation that works whenever you press the SHIFT KEY
OBJECTIVES
- Have the arm sway back and fourth.
function userrun(localkey)
if localkey:byte() == 48 and bool_ready == true and bool_run == false then
if bool_move == true then
bool_run = true
for frame = 1,10 do
regleft.C0 = regleft.C0 * CFrame.Angles(0,0,-0.0150)
wait()
end
repeat -- LOOP STARTS
for frame = 1,10 do
regleft.C0 = regleft.C0 * CFrame.Angles(0.0550,0,0)
wait(.1)
end
for frame = 1,10 do
regleft.C0 = regleft.C0 * CFrame.Angles(-0.0550,0,0)
wait()
end
until bool_run == false
end
end
end
mouse.KeyDown:connect(userrun)
Here's a part of the script, which states the 'repeat' loop that is composed of 2 'for' loops. I want the arm to sway, having an exact timing for me to prevent any errors to the arm itself. 'regweld' are some welds in the arm i used so i can perform this type of method. and of course, useless(in this situation) booleans.
The result: https://gyazo.com/ad706a563d6706ce41dcd16e72effcf5
As you see, it does NOT sway properly, due to the fact that it breaks the arm and continue moving forward and forward, i believe it is due to the speed of both loop that has no 'wait' in it. But that just makes it too slow, not synchronizing with the steps of the character.
Any scripters can help me out here and give me an idea or something that i can do for me to surpass and resolve this problem?
- LW14

1 comment
You didn't even answer the question..