Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

question about reflectance with a script?

Asked by 2 days ago

if script.Parent.Reflectance == 0.65 then print("Reflectance") end

if i do that it wont detect anything, but only can detect if reflectance is set to 0 or 1,i need this for part of my gun system

1 answer

Log in to vote
0
Answered by
Vathriel 477 Moderation Voter
2 days ago
Edited 2 days ago

You're encountering a floating point error.

I'm not going to do the math behind it right now but you can essentially think of this instead as a margin of error problem.

Try this:

if math.abs(game.Workspace.Baseplate.Reflectance-0.65) < 0.01 then print("Reflectance") end

Here is a link to floating point error information:

Floating Point Arithmetic

Video of the Representation

Ad

Answer this question