Sorry I didn't really know how to write this question, but anyways I've been recreating a game that died recently and there's this one move called water wave, demonstrated here: https://gyazo.com/87eab1ddad60a25a51b11fbb595f765f
This is how it's supposed to look, but here's what happens when I try to make it: https://gyazo.com/50e36d797f3cc872e24c9a2265836674
Anyone know what's causing this problem?
Gyro = Instance.new("BodyGyro")
Gyro.Parent = Character.Torso
Gyro.D = 100
Gyro.cframe = Character.Torso.CFrame
Gyro.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
Position = Instance.new("BodyPosition")
Position.Parent = Character.Torso
Position.position = Character.Torso.Position*130
Position.maxForce = Vector3.new(math.huge, math.huge, math.huge)
for i = 1, 15 do
Position.position = Character.Torso.Position + Vector3.new(0, -0.5, 0)
Gyro.cframe = Character.Torso.CFrame * CFrame.Angles(-0.6, 0, 0)
rightarm.C0 = rightarm.C0 * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0.2)
leftarm.C0 = leftarm.C0 * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, -0.2)
rightleg.C0 = rightleg.C0 * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0.1)
leftleg.C0 = leftleg.C0 * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, -0.1)
wait()
end
handle = Instance.new("Part")
handle.formFactor = "Symmetric"
handle.BrickColor = BrickColor.new("Bright blue")
handle.Name = "earthwall"
handle.Transparency = 0.5
handle.Parent = workspace
handle.TopSurface = "Smooth"
handle.BottomSurface = "Smooth"
handle.Size = Vector3.new(40, 40, 50)
handle.CFrame = Character.Torso.CFrame * CFrame.new(0, 20, -2) * CFrame.Angles(-3, 0, 0)
handle.Anchored = true
for i = 1, 20 do
handle.CFrame = handle.CFrame * CFrame.new(0, -1, -0.6)
wait()
end
handle.Anchored = false
b = Instance.new("BodyVelocity")
b.Parent = handle
b.maxForce = Vector3.new(math.huge, math.huge, math.huge)
b.velocity = Character.Torso.CFrame.lookVector * 90
wait(0.05)
for i = 1, 10 do
Position.position = Character.Torso.Position + Vector3.new(0, 1, 0)
Gyro.cframe = Character.Torso.CFrame * CFrame.Angles(0.2, 0, 0)
rightarm.C0 = rightarm.C0 * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, -0.2)
leftarm.C0 = leftarm.C0 * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0.2)
rightleg.C0 = rightleg.C0 * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, -0.1)
leftleg.C0 = leftleg.C0 * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0.1)
wait()
end
The wave shoots back towards the player instead of remaining in the same area, this is kind of my problem with for i loops because i can't understand how to make them work properly, any suggestions would be nice.
What I'd like to know is: -Why it's shooting back at me -How to fix it

2 comments
https://forum.scriptinghelpers.org/topic/189/please-share-links-correctly
Have you ever heard of local varables?