I am making a Kamehameha, for some reason, randomly, the loop will make it drift off to the side. I have no idea how to fix it.
(For people who want to see it for themselves I edited the script to work with an Instance.new)
function kame(player, localplayer, character, size)
local length = 5 -- This will be the length of the attack
local place = 5 -- The offset for how far ahead the attack will be
local noMove = length / 2 -- Don't touch this
local atkTime = 0.1 -- The rate at which the attack dissapates
local transRemove = 0.1 -- The rate at which transperancy increases
local wave = Instance.new("Part")
local torso = localplayer.Character.UpperTorso
wave.CFrame = torso.CFrame + torso.CFrame.lookVector * place
wave.Orientation = wave.Orientation + Vector3.new(90, 0, 0)
wave.Size = wave.Size + Vector3.new(size, 0, size)
wave.Anchored = true
wave.CanCollide = False
wave.Parent = game.Workspace
for i = 20, -100, -1 do -- Problem Area
wait(0.1)
print("working")
place = place + noMove
wave.Size = wave.Size + Vector3.new(0, length, 0)
wave.CFrame = torso.CFrame + torso.CFrame.lookVector * place
wave.Orientation = wave.Orientation + Vector3.new(90, 0, 0)
if i < 11 then
wave.Transparency = wave.Transparency + transRemove
end
if wave.Transparency > 1 then
wave:Destroy()
break
end
end
for i=1, #character do
if character[i].ClassName == "Part" then
character[i].Anchored = false
end
end
localplayer.Character.Humanoid.WalkSpeed = 16
localplayer.Character.Humanoid.JumpPower = 50
end
The script is supposed to just make it appear directly in front of me and expand forwards, but sometimes it veers to the side.
