The code is below.
This function instantiates a block that should expand in one direction. It is welded to a ball. The ball works perfectly by the way. It's just welded to the player.
When this part extends, basically the player goes into a frenzy and flings around a bunch. How do I stop this?
local AttackLine = Instance.new("Part", Character)
AttackLine.CanCollide = false
AttackLine.Transparency = 0.5
AttackLine.BrickColor = BrickColor.new("Teal")
AttackLine.Name = "AttackLine"
AttackLine.Size = Vector3.new(0.2,10,0.2)
local weld = Instance.new("Weld", AttackLine)
weld.Part0 = AttackLine
AttackLine.CFrame = Character["RightHand"].CFrame
weld.Part1 = Character["RightHand"]
weld.C0 = AttackLine.CFrame:inverse()
weld.C1 = Character["RightHand"].CFrame:inverse()
local originalFrame = AttackLine.CFrame
for i = 0, length, length/10 do
AttackLine:Resize(Enum.NormalId.Bottom,i*500)--AttackLine.Size:lerp(Vector3.new(0.2,50,0.2), i)
AttackLine.CanCollide = false
local weld2 = Instance.new("Weld", AttackLine)
weld2.Part0 = AttackLine
AttackLine.CFrame = Character["Chargeball"].CFrame
weld2.Part1 = Character["Chargeball"]
weld2.C0 = AttackLine.CFrame:inverse()
weld2.C1 = Character["Chargeball"].CFrame:inverse()
wait(0.1)
end
