Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Decal transparency from script does not work can someone help?

Asked by 1 year ago

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

Log in to vote
0
Answered by 1 year ago
Edited 1 year ago

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
Ad

Answer this question