So I’m creating effect using model which moves with vector force, but I can’t destroy model after effect, so here is my script, it starts after remote event fired from server to client(it’s local script), it’s located in started players scripts and model of ben is located in ReplicatedStorage , it looks like vector force works, but I can’t destroy the model, prints works too and it says that parent of model is nil
All you need:
print("Ben") -- line 34
local projectile = objectToAttack:Clone()
Debris:AddItem(projectile, 0.5)
objectToAttack.Parent = workspace
for i,v in pairs(objectToAttack:GetDescendants()) do
if v:IsA("BasePart") then
--v.Anchored = true
--v.CanCollide = false
end
end
objectToAttack:MoveTo(target.Head.Position + Vector3.new(0,2,0))
local distanceToMob = (target.HumanoidRootPart.Position - tower.HumanoidRootPart.Position).Magnitude
--local projectileTween = TweenService:Create(projectile.HumanoidRootPart, TweenInfo.new(0.5), {Position = target.HumanoidRootPart.Position})
print(projectile.HumanoidRootPart.Position) -- line 47
--projectileTween:Play()
--local vectorForce = Instance.new("AlignPosition")
local vectorForce = Instance.new("VectorForce")
local Attachment0 = Instance.new("Attachment")
local Attachment1 = Instance.new("Attachment")
Attachment0.Parent = projectile.HumanoidRootPart
Attachment1.Parent = projectile.HumanoidRootPart
Attachment0.CFrame = target.Head.CFrame * CFrame.new(0,5,0)
Attachment1.CFrame = target.Head.CFrame
vectorForce.Attachment0 = Attachment0
vectorForce.Attachment1 = Attachment1
--vectorForce.MaxForce = distanceToMob
vectorForce.Force = target.Head.Position
vectorForce.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
--vectorForce.Magnitude = distanceToMob
--vectorForce
--vectorForce.MaxForce = 100000
vectorForce.Parent = projectile.HumanoidRootPart
vectorForce.ApplyAtCenterOfMass = true
vectorForce.Enabled = true
--vectorForce.Force = Attachment1.Position
vectorForce.Visible = true
--vectorForce.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
--lineForce.
Debris:AddItem(projectile, 0.5)
print(projectile.Parent) -- line 73
print(projectile.HumanoidRootPart.Position) -- line 74
--projectileTween.Completed:Wait()
print(projectile.HumanoidRootPart.Position) -- line 76
print("Moved") -- line 77
task.wait(0.5)
print(projectile.Parent) -- line 79
projectile:Destroy() -- line 80