Good morning/afternoon/evening, ladies and gentlemen.
I'm trying to create a fireball in which breaks into smaller fireballs upon impact against a hard feature being cancollide = true and anchored = true. The fireball scripts works as far as generating a fireball in front where my torso front position is facing perfectly. However, the spread effect is where I'm having some troubles. All suggestions and recommendations are welcome. Thank you, for your time.
local function GenerateFireball(Location, Direction, Length) -- CFrame, Vector3, Int local NewFireball = BaseFireball:Clone() NewFireball.CFrame = Location NewFireball:WaitForChild('Force').Velocity = Direction * 100 NewFireball.Parent = workspace delay(Length, function() NewFireball:Destroy() end) local Debounce = false NewFireball.Touched:Connect(function(Part) if not Debounce then if Players:GetPlayerFromCharacter(Part.Parent) and Players:GetPlayerFromCharacter(Part.Parent).Character ~= Creator then Debounce = true local Humanoid = Part.Parent:FindFirstChild('Humanoid') Humanoid.Health = Humanoid.Health - (Humanoid.MaxHealth / 3) elseif Part.Anchored == true and Part.CanCollide == true then for i=1,10 do local part = BaseFireball:clone() part.Parent = workspace part.Position = BaseFireball.Position BaseVelocity:clone().Parent = part part.Size = Vector3.new(0.5,0.5,0.5) part.CFrame = BaseFireball.CFrame --part.BodyVelocity.MaxForce = Vector3.new(1e8,0,1e8) --part.ParticleEmitter.LockedToPart = false part.BaseVelocity = Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30)) part.Parent = game.Workspace game.Debris:AddItem(part,1) end wait(1) Debounce = false end end end) end
~ sparkevin