I tried to modify a free model but it didnt work so now i am asking people for help lol
Main:
local ReloadTime = 0
local ExplosionSize = 12
local ExplosionDelay = 3.5
local Bomb = script.Parent:WaitForChild("Bomb")
Bomb.Parent = game.ServerStorage
-- // Variables: // --
local Fire = script.Parent.Fire
local Firing = false
function Reload()
wait(ReloadTime)
Firing = true
end
Fire.OnServerEvent:Connect(function(plr)
if Firing == false then
Firing = true
local Clone = game.ServerStorage.Bomb:Clone()
Clone.Parent = game.Workspace
Clone.Name = "BombDisplay"
Clone.CFrame = CFrame.new(script.Parent.Handle.Position)
local X = Clone.CFrame.X
local Y = Clone.CFrame.Y - 0.5
local Z = Clone.CFrame.Z
Clone.CFrame = CFrame.new(X,Y,Z)
wait(ExplosionDelay)
local Explosion = Instance.new("Explosion",game.Workspace)
Explosion.BlastRadius = ExplosionSize
Explosion.Position = Clone.Position
Clone:Destroy()
Reload()
end
end)
Other: (idk what it does)
local Tool = script.Parent
Tool.Activated:Connect(function()
script.Parent.Fire:FireServer()
end)
wait(ExplosionDelay) is your answer.
You can either delete that line, replace ExplosionDelay with a different number like 2, which makes it wait 2 seconds, or (recommended) you can change the value of ExplosionDelay at the top of the script from 3.5 to 2.
I changed the code where the delay is 0 and the bomb can be fired at anytime.
local ReloadTime = 0
local ExplosionSize = 12
local ExplosionDelay = 0
local Bomb = script.Parent:WaitForChild("Bomb")
Bomb.Parent = game.ServerStorage
local Fire = script.Parent.Fire
local Firing = true -- Set Firing to true initially
function Reload()
wait(ReloadTime)
Firing = true
end
Fire.OnServerEvent:Connect(function(plr)
if Firing == true then
Firing = false
local Clone = game.ServerStorage.Bomb:Clone()
Clone.Parent = game.Workspace
Clone.Name = "BombDisplay"
Clone.CFrame = CFrame.new(script.Parent.Handle.Position)
local X = Clone.CFrame.X
local Y = Clone.CFrame.Y - 0.5
local Z = Clone.CFrame.Z
Clone.CFrame = CFrame.new(X,Y,Z)
wait(ExplosionDelay)
local Explosion = Instance.new("Explosion",game.Workspace)
Explosion.BlastRadius = ExplosionSize
Explosion.Position = Clone.Position
Clone:Destroy()
Reload()
end
end)
local ReloadTime = 0
local ExplosionSize = 12
local ExplosionDelay = 3.5
local Bomb = script.Parent:WaitForChild("Bomb")
Bomb.Parent = game.ServerStorage
-- // Variables: // --
local Fire = script.Parent.Fire
local Firing = false
function Reload()
wait(ReloadTime)
Firing = true
end
Fire.OnServerEvent:Connect(function(plr)
local Clone = game.ServerStorage.Bomb:Clone()
Clone.Parent = game.Workspace
Clone.Name = "BombDisplay"
Clone.CFrame = CFrame.new(script.Parent.Handle.Position)
local X = Clone.CFrame.X
local Y = Clone.CFrame.Y - 0.5
local Z = Clone.CFrame.Z
Clone.CFrame = CFrame.new(X,Y,Z)
wait(ExplosionDelay)
local Explosion = Instance.new("Explosion",game.Workspace)
Explosion.BlastRadius = ExplosionSize
Explosion.Position = Clone.Position
Clone:Destroy()
Reload()
end)