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

question about reflectance with a script?

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

✓ Accepted answer

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

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