The Explosion part has weld when I press Play and load as myself, even on server, but it does not do the desired function I want it to do, which is increasing in size, then disappearing and then repeating.
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)
local thing = script.Parent
local explosion = thing.Explosion
explosion.Transparency = 0
local isActive = false
local weld = Instance.new("Weld")
weld.Part0 = explosion
weld.Part1 = thing
weld.Parent = explosion
local originalSize = explosion.Size
local sizeMultiplier = 2
local explosionTween = TweenService:Create(explosion, tweenInfo, {
Size = originalSize * sizeMultiplier,
Transparency = 0
})
local function combust()
if not isActive then
isActive = true
task.wait(3)
explosionTween:Play()
task.wait(3)
isActive = false
explosion.Transparency = 1
explosion.Size = originalSize
end
end
while wait(1) do
combust()
end
What about like this?
The same thing happens, the desired function I want doesn’t appear.
That’s odd, try to monitor the Explosion part’s properties. I don’t think there’s any errors either. I tested something similar in my Studio and it worked well, so I’m not certain what’s going on within yours. The task.wait
functions may be the ones making the results late.
Even after waiting for some time (Around 7-10 seconds), modifying some of the properties such as Transparency, which I only modified to 0, I still didn’t get the desired function.
I have no idea what could be causing this, other than the Script being disabled.
I have definitely not disabled the script. Perhaps you could look into my original code and try to fix the main errors? qoqr/ Falcon_Aviator’s solutions presented no errors but haven’t quite got the desired result I wanted. The issue that could be causing that in my original code was line 12, of how it’s being written or I made some errors with the Vector3.new(count,count,count), etc.
local thing = script.Parent
local explosion = thing.Explosion
explosion.Transparency = 0
local isActive = false
local function combust()
if not isActive then
isActive = true
task.wait(3)
for count = 1, 10 do
explosion.Transparency = 10 - count
explosion.Size = Vector.new(count, count, count)
task.wait(0.1)
end
task.wait(3)
for count = 10, 1, -1 do
explosion.Transparency = 10 - count
explosion.Size = Vector.new(count, count, count)
task.wait(0.1)
end
isActive = false
end
end
while true do
combust()
end
I believe this is a functional version of the original code.
Tried it, but a error appears instead.
Apologies again, I’m pretty tired so I made another mistake, I edited the code.
I tried it again, it didn’t produce the desired result. It may have to do with the rewording of certain things that is causing the problem. The output showed no errors either.
It may be, unfortunately without being in the actual Studio I can’t give a definitive or concrete answer, there seems to be missing underlying context in the problem.
local thing = script.Parent
local explosion = thing.Explosion
explosion.Transparency = 0
local isActive = false
local function combust()
if not isActive then
isActive = true
task.wait(3)
for count = 1,10 do
explosion.Transparency = count / 10
explosion.Size = count.Vector3(1,1,1)
task.wait(0.1)
end
explosion.Transparency = 0
explosion.Size = explosion.Size.Vector3(1.957,1.957,1.957)
task.wait(3)
isActive = false
end
end
combust()
The main underlying issues as stated in the original post was line 12 and 16. I had miswrote line 12 and 16 and could not figure out how to debug the problems as they both gave errors. Those are the main issues that need to be fixed.
Those issues alone would be fixed like so:
local thing = script.Parent
local explosion = thing.Explosion
explosion.Transparency = 0
local isActive = false
local function combust()
if not isActive then
isActive = true
task.wait(3)
for count = 1,10 do
explosion.Transparency = count / 10
explosion.Size = Vector3.new(count, count, count)
task.wait(0.1)
end
explosion.Transparency = 0
explosion.Size = explosion.Size * 1.957
task.wait(3)
isActive = false
end
end
combust()
It worked but I had to modify the details. One being “count” to “i” instead, and explosion.Size = Vector3.new(1.957,1.957,1.957). Here’s my new version of the code:
local thing = script.Parent
local explosion = thing.Explosion
explosion.Transparency = 0
local isActive = false
local function combust()
if not isActive then
isActive = true
task.wait(1)
for i = 1,25 do
explosion.Transparency = i / 25
explosion.Size = Vector3.new(i, i, i)
task.wait(0.0025)
end
explosion.Transparency = 0
explosion.Size = Vector3.new(1.957,1.957,1.957)
task.wait(1)
isActive = false
end
end
while true do
task.wait(0.01)
combust()
end
It is now providing the desired function that I want. Thank you both of you for your help!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.