A player's arm moves by -0.1 increments on the Z Axis whenever a they press "x"(Every 2 seconds because of the DeBounce). It does this, but the movement continues from it's like position/angle. I want the arm to return to its default position/angle after he/she presses "x".
1.The player's arm is still, at the default angle. 2.The Player's arm moves -0.1 increments on the Z Axis and a fireball projectile is released when I press "x". (There's a wait, because I added the DeBounce for the animation and the fireball projectile.) 3.The arm is still at the previouse angle.. 4.I press "x" again, and the angle of the arm increases from the last position/angle, so the arm continues this rotational process, over and over.
The following code should be inserted into the StarterPack!(You probably know this already :P)
THE FOLLOWING CODE IS TO BE INSERTED IN A LOCALSCRIPT
Player = game.Players.LocalPlayer Character = Player.Character Torso = Character.Torso Mouse = Player:GetMouse() Attack = false function onKeyDown(key) key = key:lower() if key == "x" and Attack == false then RightShoulder = Player.Character.Torso["Right Shoulder"] Run = game:GetService("RunService") for i = 1, 10 do RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.1) Run.Stepped:wait(0.025) end for i = 1, 10 do RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.1) Run.Stepped:wait(0.025) end game:GetService("Chat"):Chat(Player.Character.Head, "Fire Style: Fireball Jutsu") Attack = true x = Instance.new("Part") x.Parent = workspace x.BrickColor = BrickColor.new("Bright red") x.Size = Vector3.new(10,10,10) x.CanCollide = false x.TopSurface = "Smooth" x.BottomSurface = "Smooth" x.Shape = "Ball" x.Transparency = 0.4 x.CFrame = Torso.CFrame * CFrame.new(0,0,-6) fd = script.FireDamage:clone() fd.Parent = x y = Instance.new("BodyVelocity") y.maxForce = Vector3.new(math.huge, math.huge, math.huge) y.velocity = Torso.CFrame.lookVector * 80 y.Parent = x f = Instance.new("Fire", x) f.Size = 12 f.Heat = 0 wait(2) Attack = false x:Destroy() end end Mouse.KeyDown:connect(onKeyDown) ------------------------------------------------------------------------------------------------------------------------------------- ^^^^^THIS SCRIPT IS TO INSERTED INSIDE OF THE LOCALSCRIPT ABOVE IN ORDER FOR THE FIREBALL TO BE PROJECTED!!!!! ^^^^^ function onDamage(Part) if Part.Parent:findFirstChild("Humanoid") ~= nil and Part.Parent.Name ~= "script.Parent.Name" then script.Disabled = true f = Instance.new("Fire", Part) f.Size = f.Size +0.25 for i = 1, 25 do Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health -1 wait(0.05) end Part.Parent.Humanoid.PlatformStand = false --Make true if you want the enemy to "sit" when the fireball hits them! wait(1) f:remove() --or f:destroy() script.Parent:remove() end wait(0.025) end script.Parent.Touched:connect(onDamage)