Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Attempt to perform arithmetic on field Transparency (a user data value)?

SmokeEmitter variable is just calling out my particle emitter.

while Held do
		SmokeEmitter.Transparency=SmokeEmitter.Transparency+.01
		wait()
	end

2 answers

✓ Accepted answer

The Transparency property for ParticleEmitters is a NumberSequence value, not a Number value. This is why you are getting an arithmetic error because these two values (NumberSequence and Number) cannot be added together.

I have never heard of NumberSequence values before this, but I was able to find enough about it on the wiki to answer your question.

More Information on NumberSequence values here: http://wiki.roblox.com/index.php?title=API:NumberSequence

All you need to do is to use the NumberSequence constructor to create a compatible value type for the ParticleEmitter's transparency.

local num = 0
local particleEmitter = script.Parent.ParticleEmitter

particleEmitter.Transparency = NumberSequence.new(num) -- Constructor here

As for adding or subtracting two NumberSequence types, I do not think that is possible, but you can create a loop to create a "fading" effect.

for i = 0,1, .1 do
	script.Parent.ParticleEmitter.Transparency = NumberSequence.new(i)
	wait()
end

If there are any questions, feel free to ask.

1 comment

0

Yes! I was trying to a fading effect, I'll try your script and I'll answer what happened, thanks for answering!

Automatic script:

Place this script inside of the smoke emiter

local smoke = script.Parent

while true do
	smoke.SmokeEmitter.Transparency = smoke.SmokeEmitter.Transparency + 0.01
	wait(0.1)
end
	

Tool activated script:

local tool = script.Parent
 
local function onEquip()
	while true do
		game.Workspace.Smoke.SmokeEmitter.Transparency = game.Workspace.Smoke.SmokeEmitter.Transparency + 0.01 -- Change the lines to the smoke in the workspace.
		wait(0.1)
	end
end

tool.Equipped:connect(onEquip)

1 comment

0

Didn't work but thanks for answering.

This discussion is preserved as it was. New answers, comments, and votes are closed.