I have been trying to make a first person viewmodel. However, when I set the part.Transparency = 1 and part.LocalTransparencyModifier = -0.5, the client-side transparency remains as 1.
The devhub provides this script to show us how the modifier works:
local clientTransparency = part.Transparency + (1 * part.localTransparencyModifier)
So, according to this script, my idea should work.
(by the way, when I set the transparency to 0, and modifier to 0.5, it works as expected, client-side transparency is 0.5)
The code is just as simple as I explained
Besides, how does this equation work (the one highlighted with red)?
0.5 + 1*0.5 should be equal to 1??
“Besides, how does this equation work (the one highlighted with red)?
0.5 + 1*0.5 should be equal to 1??”
You’re right it equals 1 but I think luau doesn’t use the priority of operations rule meaning that first 0.5 + 1 is made first so 1.5 * 0.5 = 0.75 I think maybe it affects your script.
EDIT: I tested in my test game if what I said is true but luau uses the priority of operations this came out as 1
print(0.5 + 1 * 0.5)
that means the devhub haves this error where someone didn’t knew about priority of operations it’s not your fault.
I believe what it is doing is it takes the parts transparency, subtracts that from 1, and the fraction that is left over is multiplied by the localtransparencymodifier. So formula wise it would be:
local clientTransparency = part.Transparency + (1-part.Transparency) * part.localTransparencyModifier