For example if I’d like to abbriviate gravity to a smaller number as the default roblox value for default gravity is 196.2 and if i would like to be able to change it in a gui for example inputting 1 for 196.2
and if I went lower then 1 it would make less gravity which would result in floating
could you just multiply the text input value by 196.2?
input 1 → 1 * 196.2 = 196.2
input 0.75 → 0.75 * 196.2 = 147.2
it’d be like entering a % modifier
This is just normalization with a factor, relatively simple.
Here’s some code to assist you.
local function Factor(Base, Factor)
return {
Value = Base * Factor,
UnitValue = Factor
}
end
-- Example usage:
local BaseGravity = 196.2
local Factor = 1
local MyTextbox = ...
MyTextbox.FocusLost:Connect(function()
local Update = tonumber(MyTextbox.Text)
if Update then
Factor = Update
workspace.Gravity = Factor(BaseGravity, Factor).Value
end
end)
Not the prettiest of explanations or code examples but you should get the idea.