[Solved] How to make a parts transparency less when a value is higher number than 2 numbers

How would i make it so raising a value would make a part easier to see, For example i have 2 numbers 0 and 1000, If i have a value of 500 it would return 0.5

Another example is i have a number between 0 and 1000 and a value of 200 so the transparency would be 0.8

Hope you can understand what im trying to say, Ive been wondering how for to do this for a while now

1 Like

Here is an example script

if valuehere.Value <= 500 then
	part.Transparency  = 0.5
elseif valuehere.Value <= 200 then
	part.Transparency = 0.8
end
1 Like
if value > 2 then
part.Transparency -= 1
end

something like this

1 Like

I want it so it can be any number and it will return a value, Not just my 2 examples

If you are looking for a linear decrease, I would suggest using a linear regression.
A value of 0 = 1 transparency
A value of 1000 = 0 transparency

transparency = -0.001*value+1
1 Like

um so do u mean if the value gets higher the part’s transparency gets lower or higher?

1 Like

Then you’re gonna have to use Changed function for this
https://developer.roblox.com/en-us/api-reference/event/NumberValue/Changed

1 Like

It dosent work but it looks like your on the right track

Are you lookin for something like this?

local part = workspace.Part

for i = 0, 50, 1 do
   wait(0.1)
   part.Transparecny = linear(i, 0, 1, 50)
end

From: How do I ease this value? - #2 by starmaq

The equation works. The value will have to be a number between 0-1000 and it will return a value between 1-0.

This works i accidently had +100 instead of 1, Thank you

1 Like