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

Decal transparency from script does not work can someone help?

This script works but the decal transparency doesnt change!

local Wire = script.Parent
local Strength = script.Parent.unpowered.Transparency	

Strength = 0.0666 * Wire:GetAttribute("SignalStrength")

Wire:GetAttributeChangedSignal("SignalStrength"):Connect(function()
	Strength = 0.0666 * Wire:GetAttribute("SignalStrength")
end)

1 answer

So when you set Strength to the transparency it’s not actually the transparency but the value. So what you are actually saying is strength = some value. Changing strength doesn’t change the transparency. What you need to do is say unpowered.Transparency = new value.

Or

You set strength to unpowered.

local Strength = script.Parent.unpowered
Strength.Transparency = .0666 * Wire:GetAttribute(“SignalStrength”)

So if you still don’t get it, when you say

Strength = unpowered.transparency

It’s actually saying, let me take the value of transparency which is .99 or whatever and set strength to that. It’s not actually referencing unpowered.

Unpowered.Transparency = 5
Strength = unpowered.Transparency
Thus, 
Strength = 5

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