Explosion.Visible = true/false

Please? :woohoo: Simple request. The new explosion physics are wonderful and I’m using them a lot more now- but there’s no way to make them invisible; even if the pressure is at 0 it shows up. It’d be lovely for custom explosion visuals!

3 Likes

function createInvisibleExplosion(Position) local Explosion = Instance.new("Explosion", game.Workspace) Explosion.Position = Position wait(0.03) Explosion:Destroy() end wait(2) createInvisibleExplosion(Vector3.new(1, 0, 0))

That’s the best I got.

2 Likes

Gonna wanna do 0.02 since 30 FPS is 0.03, but there is a tendency to hit 31, thus giving the chance that the explosion is seen one frame.

Renderstepped:wait()?
I guess that would mean you need to create the explosion from a localscript

[quote] Renderstepped:wait()?
I guess that would mean you need to create the explosion from a localscript [/quote]

thought about that, but if they were filtering then it’d have to be local

UNLESS they want all explosions to be rendered locally and have a remote create a Vector3 value every time each client needs to create their split second explosion

Put the explosion in a server side camera and it wont replicate to clients.

Dont know how well that interacts with physics if theyre distributed to clients though. I would assume it will still work.

1 Like

Why do that when its easily scriptable! Heres some of my own code for “invisible” explosions

[code]
function eng.recursionPartList(obj)
–Returs a table of parts found in the ancestry of “obj”
local oL = {}
for i,v in pairs(obj:children()) do
if v:IsA(“BasePart”) then
oL[i] = v
else
eng.recursionPartList(v)
end
end
return oL
end

function eng.phys_explosion(Pos,Rad,Pres,Par)
–Pos - The origin of the “explosion” (Vector3)
–Rad - The radius of the “explosion” (Int)
–Pres - The pressure of the “explosion” (Int)
–Par - Either a single part, or a model to search for parts (Instance or Table)
–If parameter “Par” is a Part, it will only set the parts velocity,
–however if you use a model it will set the velocities of everything inside the model
–Usage on weapon physics: use the ray’s position as Pos, and the ray’s hit as Par!
if type(Par) == “table” then
for _,v in pairs(Par) do
if (not v.Anchored) and (v.Position-Pos).magnitude < Rad then
v:BreakJoints()
v.Anchored = true
v.Velocity = (v.Position - Pos).unit * (Pres / (v.Position - Pos).magnitude)
v.Anchored = false
end
end
elseif type(Par) == “userdata” and (not Par:IsA(“BasePart”)) then
local objectList = eng.recursionPartList(Par)
for _,v in pairs(objectList) do
if (not v.Anchored) and (v.Position-Pos).magnitude < Rad then
v:BreakJoints()
v.Anchored = true
v.Velocity = (v.Position - Pos).unit * (Pres / (v.Position - Pos).magnitude)
v.Anchored = false
end
end
elseif Par:IsA(“BasePart”) then
Par:BreakJoints()
Par.Anchored = true
Par.Velocity = (Par.Position - Pos).unit * (Pres / (Par.Position - Pos).magnitude)
Par.Anchored = false
end
end[/code]

[quote] Why do that when its easily scriptable! Heres some of my own code for “invisible” explosions

[code]
function eng.recursionPartList(obj)
–Returs a table of parts found in the ancestry of “obj”
local oL = {}
for i,v in pairs(obj:children()) do
if v:IsA(“BasePart”) then
oL[i] = v
else
eng.recursionPartList(v)
end
end
return oL
end

function eng.phys_explosion(Pos,Rad,Pres,Par)
–Pos - The origin of the “explosion” (Vector3)
–Rad - The radius of the “explosion” (Int)
–Pres - The pressure of the “explosion” (Int)
–Par - Either a single part, or a model to search for parts (Instance or Table)
–If parameter “Par” is a Part, it will only set the parts velocity,
–however if you use a model it will set the velocities of everything inside the model
–Usage on weapon physics: use the ray’s position as Pos, and the ray’s hit as Par!
if type(Par) == “table” then
for _,v in pairs(Par) do
if (not v.Anchored) and (v.Position-Pos).magnitude < Rad then
v:BreakJoints()
v.Anchored = true
v.Velocity = (v.Position - Pos).unit * (Pres / (v.Position - Pos).magnitude)
v.Anchored = false
end
end
elseif type(Par) == “userdata” and (not Par:IsA(“BasePart”)) then
local objectList = eng.recursionPartList(Par)
for _,v in pairs(objectList) do
if (not v.Anchored) and (v.Position-Pos).magnitude < Rad then
v:BreakJoints()
v.Anchored = true
v.Velocity = (v.Position - Pos).unit * (Pres / (v.Position - Pos).magnitude)
v.Anchored = false
end
end
elseif Par:IsA(“BasePart”) then
Par:BreakJoints()
Par.Anchored = true
Par.Velocity = (Par.Position - Pos).unit * (Pres / (Par.Position - Pos).magnitude)
Par.Anchored = false
end
end[/code] [/quote]Because my explosions are already pretty heavily customized. That’s really neat, but not the answer I’m looking for (neither is forcing them to exist for only one frame)!

Why would you go to all of this trouble? Can’t you just make an explosion inside of a camera in the server? It won’t appear on the clients but it will still blow stuff up.

[quote] Why do that when its easily scriptable! Heres some of my own code for “invisible” explosions

-snip-

How are they customized?

[quote] Renderstepped:wait()?
I guess that would mean you need to create the explosion from a localscript [/quote]

You can do RunService.Stepped:wait() or RunService.Heartbeat:wait() on the server.

[quote] Renderstepped:wait()?
I guess that would mean you need to create the explosion from a localscript [/quote]

You can do RunService.Stepped:wait() or RunService.Heartbeat:wait() on the server.[/quote]

Yeah but obviously they aren’t 60 frames per second like RenderStepped

[quote] [quote=“StealthKing95” post=67232]Why do that when its easily scriptable! Heres some of my own code for “invisible” explosions

-snip-

How are they customized?[/quote]They rely heavily on the Explosion.Hit event and have custom damage settings. Having something that requires a touch event only appear for one frame is a really bad idea.

I want my explosions to be fully functional but invisible. Hence this request.

[quote] [quote=“TylerMcBride” post=67240][quote=“StealthKing95” post=67232]Why do that when its easily scriptable! Heres some of my own code for “invisible” explosions

-snip-

How are they customized?[/quote]They rely heavily on the Explosion.Hit event and have custom damage settings. Having something that requires a touch event only appear for one frame is a really bad idea.

I want my explosions to be fully functional but invisible. Hence this request.[/quote]

Damage could be simply done:

[code]
local totalradius = 20–the radius after which damage is 0
local killradius = 4 --the radius in which you will instantly die
–If you are between these the damage is calculated relative on your distance between these radiuses

local mult = ((totalradius - killradius) / 100)
local dmg = (totalradius - dist) / mult
dmg = math.floor(dmg)
whatever.Humanoid:TakeDamage(dmg)[/code]

Server replication is done at 20FPS, but even so, removing it 1/30 of a second later may still cause it to replicate, and then it would appear on clients’ screens for 1/20 of a second. However, this is not what the OP wants.

The custom explosion code down below could be easily edited to include a LuaSignal to simulate Hit. Even better, you could include extra code to show the distance the object was away, and how much damage it should take according to a certain wave function, if you wanted to get fancy.

To avoid API spam, I think all objects should have bools for PhysicsEnabled and RenderingEnabled. I also think that these things should not be able to be used by the client except local objects. So the client obeys the rules set by these bools, but they can’t set them. Read-only from the client to prevent massive abuse.

Bumping this. It’s even more relevant now that ParticleEmitters are out.

If your game is filtering, then in a local script

workspace.DescendantAdded:connect (function (obj)
if obj:IsA ("Explosion") then
obj:Destroy ()
end
end)

should work. It might do something funky for distributed physics, though. I’m not sure.

Doesn’t work. Explosion still shows up, davidii

Something unexpectedly tried to set the parent of Explosion to NULL while trying to set the parent of Explosion. Current parent is Workspace.

Besides, you need to wait() before instant creation/deletion. With it you still see the white/orange part of the explosion before it goes away

“Something unexpectedly tried to set the parent of Explosion to NULL while trying to set the parent of Explosion. Current parent is Workspace.”

You need to delete it in a new thread – not wait().

local explosion = createExplosion()
spawn(function() explosion:Destroy() end)

Thanks, that deletes it faster. There’s still a flash of white though echo. We really do need explosion.visible