So lets say I have a value that ranges from 1-100 and a part that changes size depending on that value
I want the part to be 25% its original size at 1 and 100% its size at 100
I also don’t want the part to start floating so I would need to decrease and increase its Y position value depending on that value as well
Where do I even start?
1 Like
Why not use TweenService? It kinda kewl.
I dont even know what math I need to convert a 100-1 value to 100-25
Its not to shrink it dynamically because the value decreases and increases
and it depends on external factors that are undeterminable
My best thinking is :
Make a statement if the Value is 1 or greater than that, save a Part.Size value first then use tweenservice to tween Part size.
local part = script.Parent
local Value = part:FindFirstChild("Value")
local Debounce = true
part.Touched:Connect(function(Hit)
if Debounce == true then
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
if Humanoid then
print("Succes")
Value.Value += 1
Debounce = false
task.wait(3)
Debounce = true
end
end
end)
Value.Changed:Connect(function()
if Value.Value >= 1 then
part.Size = part.Size / 2 -- rate...Maybe? XD
print("b")
end
end)
very simple script. Don’t use it lol.
Well since 0.25 is 25% and 1 is 100%
you could use a little bit of math to do it including the lerp formula (a + (b - a) * x)
local function convert(a, num)
local num = 0.25 + (1 - 0.25) * (num * 0.01)
return a * num
end
print(convert(1, 0))
-- 0.25
print(convert(1, 100))
-- 1
Not sure if i this is what you wanted but i hope it helps
so that can convert 1-100 to 25-100?
Hmm, not exactly but it converts 0-100 to 25-100
1 Like
So how do I use it exactly? Like where do I put the value