So, I’m currently working on a game with magic, kind of like Arcane Adventures (if you’ve ever heard or played it, it was a great game), and I am working on a kind of boss battle. The boss works and the attacks work and deal damage as intended, but one attack doesn’t work as I intended it to. When testing, the projectiles summoned from the attack would always collide with each other and “explode” before reaching the player, this video will explain what I’m talking about:
Basically, not all projectiles actually reach anywhere close to the player, it instead just hits another then disappears. This is the code of the specific attack showed in the video:
function plasmastorm()
if debounce == false then
debounce = true
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://3953961100"
local playanim = npc.Humanoid:LoadAnimation(anim)
playanim:Play()
local BG = Instance.new("BodyGyro", npc.HumanoidRootPart)
BG.MaxTorque = Vector3.new(250000,250000,250000)
BG.P = 20000
BG.D = 150
spawn(function()
while wait(.01) do
BG.CFrame = CFrame.new(npc.HumanoidRootPart.Position, target.HumanoidRootPart.Position - Vector3.new(0,12,0))
end
end)
game.Debris:AddItem(BG,20)
wait(.5)
playanim:AdjustSpeed(0)
local pcircle = game.Lighting.PlasmaCircle:Clone()
local pcircle2 = game.Lighting.PlasmaCircle:Clone()
local pcircle3 = game.Lighting.PlasmaCircle:Clone()
local pcircle4 = game.Lighting.PlasmaCircle:Clone()
local pcircle5 = game.Lighting.PlasmaCircle:Clone()
pcircle.Parent = workspace.Magic
pcircle2.Parent = workspace.Magic
pcircle3.Parent = workspace.Magic
pcircle4.Parent = workspace.Magic
pcircle5.Parent = workspace.Magic
spawn(function()
while wait(.01) do
pcircle.CFrame = npc.HumanoidRootPart.CFrame*CFrame.new(0.45,0.5,-4)
pcircle2.CFrame = npc.HumanoidRootPart.CFrame*CFrame.new(10,8,-4)
pcircle3.CFrame = npc.HumanoidRootPart.CFrame*CFrame.new(-9,8,-4)
pcircle4.CFrame = npc.HumanoidRootPart.CFrame*CFrame.new(10,-6.4,-4)
pcircle5.CFrame = npc.HumanoidRootPart.CFrame*CFrame.new(-9,-6.4,-4)
if pcircle.Orientation ~= npc.HumanoidRootPart.Orientation then
pcircle.Orientation = pcircle.Orientation + npc.HumanoidRootPart.Orientation
pcircle2.Orientation = pcircle.Orientation + npc.HumanoidRootPart.Orientation
pcircle3.Orientation = pcircle.Orientation + npc.HumanoidRootPart.Orientation
pcircle4.Orientation = pcircle.Orientation + npc.HumanoidRootPart.Orientation
pcircle5.Orientation = pcircle.Orientation + npc.HumanoidRootPart.Orientation
end
end
end)
pcircle.Size = Vector3.new(0,0,0)
pcircle2.Size = Vector3.new(0,0,0)
pcircle3.Size = Vector3.new(0,0,0)
pcircle4.Size = Vector3.new(0,0,0)
pcircle5.Size = Vector3.new(0,0,0)
game.Debris:AddItem(pcircle,25)
game.Debris:AddItem(pcircle2,25)
game.Debris:AddItem(pcircle3,25)
game.Debris:AddItem(pcircle4,25)
game.Debris:AddItem(pcircle5,25)
local castSound = game.Lighting.PlasmaCastSound:Clone()
castSound.Parent = pcircle
castSound.PlaybackSpeed = 0.35
castSound:Play()
game.Debris:AddItem(castSound,2)
pcircle.Size = Vector3.new(3,3,.05)
pcircle2.Size = Vector3.new(2,2,.05)
pcircle3.Size = Vector3.new(2,2,.05)
pcircle4.Size = Vector3.new(2,2,.05)
pcircle5.Size = Vector3.new(2,2,.05)
wait(0.01)
pcircle.Size = Vector3.new(6,6,.05)
pcircle2.Size = Vector3.new(4,4,0)
pcircle3.Size = Vector3.new(4,4,0)
pcircle4.Size = Vector3.new(4,4,0)
pcircle5.Size = Vector3.new(4,4,0)
wait(0.01)
pcircle.Size = Vector3.new(9,9,0)
pcircle2.Size = Vector3.new(6,6,0)
pcircle3.Size = Vector3.new(6,6,0)
pcircle4.Size = Vector3.new(6,6,0)
pcircle5.Size = Vector3.new(6,6,0)
wait(0.01)
pcircle.Size = Vector3.new(12,12,0)
pcircle2.Size = Vector3.new(8,8,0)
pcircle3.Size = Vector3.new(8,8,0)
pcircle4.Size = Vector3.new(8,8,0)
pcircle5.Size = Vector3.new(8,8,0)
wait(0.01)
pcircle.Size = Vector3.new(15,15,0)
pcircle2.Size = Vector3.new(10,10,0)
pcircle3.Size = Vector3.new(10,10,0)
pcircle4.Size = Vector3.new(10,10,0)
pcircle5.Size = Vector3.new(10,10,0)
wait(3)
---------- Plasma Storm ----------
game:GetService("Chat"):Chat(npc.Head, "Plasma Storm!", "Red")
for i = 1,50 do
local storm = Instance.new("Part")
storm.Name = script.Parent.Name
storm.Shape = "Ball"
storm.BrickColor = BrickColor.new("Hot pink")
storm.Material = "Neon"
storm.Size = Vector3.new(6,6,6)
storm.CanCollide = false
storm.CastShadow = false
storm.Transparency = 1
storm.Parent = workspace.Magic
local plasmaeffect = game.Lighting.PlasmaEffect:Clone()
plasmaeffect.Parent = storm
local sound = game.Lighting.PlasmaBombSound:Clone()
sound.Parent = storm
sound:Play()
storm.CFrame = npc.HumanoidRootPart.CFrame*CFrame.new(math.random(-9,10),math.random(-6.4,8),-10)
local bv = Instance.new("BodyVelocity", storm)
bv.MaxForce = Vector3.new(250000,250000,250000)
bv.Velocity = npc.HumanoidRootPart.CFrame.lookVector*120
game.Debris:AddItem(storm,15)
local dmg = game.Lighting.PlasmaStormDamage:Clone()
dmg.Parent = storm
wait(.2)
end
wait(2)
pcircle.Size = Vector3.new(12,12,0)
pcircle2.Size = Vector3.new(8,8,0)
pcircle3.Size = Vector3.new(8,8,0)
pcircle4.Size = Vector3.new(8,8,0)
pcircle5.Size = Vector3.new(8,8,0)
wait(0.01)
pcircle.Size = Vector3.new(9,9,0)
pcircle2.Size = Vector3.new(6,6,0)
pcircle3.Size = Vector3.new(6,6,0)
pcircle4.Size = Vector3.new(6,6,0)
pcircle5.Size = Vector3.new(6,6,0)
wait(0.01)
pcircle.Size = Vector3.new(6,6,0)
pcircle2.Size = Vector3.new(4,4,0)
pcircle3.Size = Vector3.new(4,4,0)
pcircle4.Size = Vector3.new(4,4,0)
pcircle5.Size = Vector3.new(4,4,0)
wait(0.01)
pcircle.Size = Vector3.new(3,3,0)
pcircle2.Size = Vector3.new(2,2,0)
pcircle3.Size = Vector3.new(2,2,0)
pcircle4.Size = Vector3.new(2,2,0)
pcircle5.Size = Vector3.new(2,2,0)
wait(0.01)
pcircle.Size = Vector3.new(0,0,0)
pcircle2.Size = Vector3.new(0,0,0)
pcircle3.Size = Vector3.new(0,0,0)
pcircle4.Size = Vector3.new(0,0,0)
pcircle5.Size = Vector3.new(0,0,0)
playanim:AdjustSpeed(100)
BG:Destroy()
wait(10)
debounce = false
end
end
And this is the damage script, which I believe is the reason why the projectiles are like this:
script.Parent.Touched:Connect(function(hit)
if hit.Parent.Parent == workspace.Effects or hit.Parent.Parent == workspace.Magic or hit.Parent.Name == script.Parent.Name then return end
spawn(function()
local explosion = script.Explosion
explosion.Disabled = false
end)
local hitbox = Instance.new("Part",workspace.Effects)
hitbox.Transparency = 1
hitbox.CanCollide = false
hitbox.Anchored = true
hitbox.Size = Vector3.new(15,15,15)
hitbox.Position = script.Parent.Position
game.Debris:AddItem(hitbox,1)
for i,v in pairs(workspace:GetChildren()) do
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= "Metta" and (hit.Parent.Torso.Position-hitbox.Position).Magnitude <= 15 then
if hit.Parent:FindFirstChild("IsPSHit") then return end
local IsPSHit = Instance.new("BoolValue",hit.Parent)
IsPSHit.Name = "IsPSHit"
game.Debris:AddItem(IsPSHit,0.5)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
Humanoid:TakeDamage(220)
script.Explosion.Disabled = false
if hit.Parent:FindFirstChild("IsPlasmaBurned") then return end
local IsPlasmaBurned = Instance.new("BoolValue",hit.Parent)
IsPlasmaBurned.Name = "IsPlasmaBurned"
game.Debris:AddItem(IsPlasmaBurned,25)
script.PlasmaBurn.Disabled = false
local PlasmaBurn = script.PlasmaBurn:Clone()
PlasmaBurn.Parent = hit.Parent
game.Debris:AddItem(PlasmaBurn,25)
wait(1)
script.Disabled = true
end
end
end)
--[[script.Parent.Touched:Connect(function(hit)
if hit.Parent.Name ~= "Metta" and hit.Parent:FindFirstChild("Part") then
script.Explosion.Disabled = false
script.Disabled = true
end
end)]]
Any help?