Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make part smoothly remove?

Asked by 8 years ago
Edited 8 years ago

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?

0
If the links won't load just copy and paste them Vinteriss 10 — 8y
0
Why not destroy the part even if it doesn't touch a humanoid? Sure, you won't have it bouncing off walls and such, but I think the problem here is that the part is going fast combined with the script going slow makes it so that by the time the script finishes the if statement, the part is past whatever it hit. shayner32 478 — 8y
0
Well I think it is not possible here. Do you know any way to "speed up" the script? Vinteriss 10 — 8y

Answer this question