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)
help
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.
1 Like
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)
that just automatically kills you lol but there is no delay
Then just change the delay, if that works.
This article is all about the explosion instance and talks about how you can handle the damage yourself.
“Explosion.DestroyJointRadiusPercent to 0 and use the Explosion.Hit event to handle the result of the explosion.”
Explosion | Documentation - Roblox Creator Hub
Replace first script with
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)
Then test