But this is the best I can do, make a fading-remove function affected parts by the blast range and using a for loop
so this is the code i excevuted:
function OnTouch(boomer)
local e = Instance.new("Explosion")
e.Hit:Connect(function(part) -- this is the Explosion.hit event to fade-remove the parts
for p = 0,1,.1 do
part.Transparency = p
wait(.3)
if part.Transparency == 1 then
part:Destroy()
end
end
end) -- i think u understand wat im doing right here
e.BlastPressure = 800000
e.BlastRadius = 70 -- note these values are intended for nuke effect
e.Parent = workspace
e.Position = script.Parent.Position
script.Parent:Destroy()
end
script.Parent.Touched:Connect(OnTouch)
Problem is the affect parts are not deleted from the .hit function, any help?
I know nothing about scripting but maybe you should just make it where its not where it explodes things and it just damages player? I dont know where im trying to go with this
No i mean i want to delete the parts that r affected by the explosion blast range by doing a fade effect and then delete it and if I can get this over with then the lag will reduce significantly and no, I want it to explode inside a building and kill players
function OnTouch(boomer)
local e = Instance.new("Explosion")
e.Hit:Connect(function(part) -- this is the Explosion.hit event to fade-remove the parts
for p = 0,1,.1 do
part.Transparency = p
wait(.3)
if part.Transparency == 1 then
part:Destroy()
end
end
end) -- i think u understand wat im doing right here
e.BlastPressure = 800000
e.BlastRadius = 70 -- note these values are intended for nuke effect
e.Parent = workspace
e.Position = script.Parent.Position
script.Parent:Destroy()
end
script.Parent.Touched:Connect(OnTouch)
I’m opening studio, I’ll see what I can do. Since you want a nuke effect, the radious of the explosion would be very big, as stated by yourself. So, what I recommend doing is creating a Sphere-shaped part, which by using TweenService, you can smoothly increase it’s size, and anything which touches it, gets destroyed.
This is a meteor script function so if theres delay needed to be added for the affected explosion parts the part*nuke) will continuously explode explode explode until like for .3 seconds and that is lagging too much
I haven’t used explosion instance for years… but maybe hit event doesn’t work because you are deleting script.Parent, which means deleting where can do something when event fired.
There’s no need to do that. :Connect() takes a function value, and, in the way we/I did there, the same moment we used :Connect(), we created a function. That makes the function anonymous, meaning it cannot be executed any time later.