So i have made an explosion script, but once i press the key, the hitbox and everything is made, but the explosion waits then does it, sorta like (sorry this will sound dumb.) "Boom!"...."Boom!"...."Boom!", I want it to happen all at once, like one huge explosion but, do not see my problem here!, any help?
Player = game.Players.LocalPlayer
repeat wait() until Player.Character or Player.Character.Parent
Character = Player.Character
local ECombatCombo = 0
Enabled = false
MoveLocked = false
--Explosive Combat, Level 5 (1st Move)
game:GetService("UserInputService").InputBegan:connect(function(input)
if input.KeyCode ~= Enum.KeyCode.Z then return end;
if ECombatCombo == 0 and Enabled == false then
Enabled = true
print("Right Swing")
game:GetService("Chat"):Chat(Character.Head, "Ha!")
local Animation = Character.Humanoid:LoadAnimation(game.ServerStorage.Animations.Explosion.ERightPunch)
local current = Animation
current:Play()
wait(0.3)
local Particle = game.ServerStorage.Particles.BombEffect:Clone()
Particle.Enabled = true
Particle.Parent = Character.RightHand
local hitbox = Instance.new("Part", game.Workspace)
hitbox.CanCollide = false
hitbox.Anchored = true
hitbox.TopSurface = 0
hitbox.BottomSurface = 0
hitbox.BrickColor = BrickColor.new("Bright red")
hitbox.Size = Vector3.new(1, 1, 1)
hitbox.CFrame = Character.RightHand.CFrame
hitbox.Rotation = Vector3.new(0, 0, 0)
--Create Explosion
local function Explode()
local Fire = game.ServerStorage.MeshEffects.ExplosiveFire:Clone()
Fire.Parent = game.Workspace
Fire.Position = hitbox.Position
Fire.CFrame = Fire.CFrame*CFrame.Angles(0, math.random(10, 25), 0)
local Smoke = game.ServerStorage.MeshEffects.ExplosiveSmoke:Clone()
Smoke.Parent = game.Workspace
Smoke.Position = hitbox.Position
Smoke.CFrame = Smoke.CFrame*CFrame.Angles(0, math.random(20, 35), 0)
local loop = 0
repeat
loop = loop +1
Fire.Mesh.Scale = Fire.Mesh.Scale+Vector3.new(1, 1, 1)
Smoke.Mesh.Scale = Smoke.Mesh.Scale+Vector3.new(1, 1, 1)
Fire.Transparency = Fire.Transparency+0.1
Smoke.Transparency = Smoke.Transparency+0.1
wait()
until loop == 10
end
for boom = 1, 10 do
--Make Explosion Happen
Explode()
end
ECombatCombo = 1
current:Stop()
Enabled = false
wait(0.3)
hitbox:Remove()
Particle.Enabled = false
wait(3)
Particle:Remove()
Also there is no "End" at the end of the line because i made the script a key press combo, please do not add one.
