Im new to lua and im not sure exactly how i could add fire to this fireball script.
game.Workspace.Fired.OnServerEvent:Connect(function(Player, Debounce) local AlreadyTouched = false local Character = Player.Character or Player.CharacterAdded:wait() Debounce = true local Fireball = Instance.new("Part") Fireball.Name = "Fireball" Fireball.Shape = Enum.PartType.Ball Fireball.Size = Vector3.new(3,3,3) Fireball.Material = Enum.Material.Neon Fireball.BrickColor = BrickColor.new("Deep orange") Fireball.CanCollide = false Fireball.Parent = Character Fireball.CFrame = Character.HumanoidRootPart.CFrame*CFrame.new(0,1,-6) local BV = Instance.new("BodyVelocity") BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge) BV.Velocity = Character.HumanoidRootPart.CFrame.lookVector*100 BV.Parent = Fireball Fireball.Touched:Connect(function(Hit) local Humanoid = Hit.Parent:FindFirstChild("Humanoid") if Humanoid == nil then return end if AlreadyTouched == false then AlreadyTouched = true if Humanoid.Parent == Character then Humanoid.Health = Humanoid.Health - 0 else Humanoid.Health = Humanoid.Health - Humanoid.MaxHealth/4 end end end) wait(2) Fireball:Destroy() Debounce = false end)
Whenever you are creating the Fireball
, also create the Fire
.
It may be easier than you think.
Instance.new("Part")
creates a part.
Instance.new("Fire")
creates a fire.
The only other thing to do, is parent it to the Fireball.
game.Workspace.Fired.OnServerEvent:Connect(function(Player, Debounce) local AlreadyTouched = false local Character = Player.Character or Player.CharacterAdded:wait() Debounce = true local Fireball = Instance.new("Part") Fireball.Name = "Fireball" Fireball.Shape = Enum.PartType.Ball Fireball.Size = Vector3.new(3,3,3) Fireball.Material = Enum.Material.Neon Fireball.BrickColor = BrickColor.new("Deep orange") Fireball.CanCollide = false Fireball.Parent = Character Fireball.CFrame = Character.HumanoidRootPart.CFrame*CFrame.new(0,1,-6) local BV = Instance.new("BodyVelocity") BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge) BV.Velocity = Character.HumanoidRootPart.CFrame.lookVector*100 BV.Parent = Fireball --adding fire local Fire = Instance.new("Fire") Fire.Parent = Fireball Fireball.Touched:Connect(function(Hit) local Humanoid = Hit.Parent:FindFirstChild("Humanoid") if Humanoid == nil then return end if AlreadyTouched == false then AlreadyTouched = true if Humanoid.Parent == Character then Humanoid.Health = Humanoid.Health - 0 else Humanoid.Health = Humanoid.Health - Humanoid.MaxHealth/4 end end end) wait(2) Fireball:Destroy() Debounce = false end)
local fire = Instance.new("Fire", Fireball) fire.Properties --set properties to have a custom effect. your choice obviously!