The players chats the spell name example : "Avada Kedavra"
it launches MainModule function (CreateSpell)
the CreateSpell function launches Touched function
Touched function:
function Touched(Spell,plr) Spell.Touched:connect(function(Hit) local HitHumanoid = Hit.Parent:findFirstChild("Humanoid") if HitHumanoid and Hit.Parent.Name ~= plr.Name and Hit.Name ~= "Handle" then if Spell.Name == "avada kedavra" then Spell:Destroy() HitHumanoid.Health = 0
CreateSpell function
function Spells.CreateSpell(Color,Name,plr) local Ball = script.SpellPart:Clone() Ball.Parent = workspace Ball.Anchored = false Ball.Name = Name Ball.BrickColor = BrickColor.new(Color) Ball.CFrame = Handle.CFrame * CFrame.new(0,1,-1) game:GetService("Debris"):AddItem(Ball,10) local Velocity = Instance.new("BodyVelocity") Velocity.Parent = Ball Velocity.velocity = ((plr.Character.Humanoid.TargetPoint - Ball.Position).unit) * 190 Touched(Ball,plr) end
The problem is that the Part that should be removed after it touches player - stutters Here are some pictures of it
1.http://prnt.sc/d48lsc 2.http://prnt.sc/d48mnm 3.http://prnt.sc/d48m4b 4.http://prnt.sc/d48mvl
Is there a way to avoid it?