I am trying to make a slider that goes from 1 to 10 (for a voting system). When you slide the slider it outputs a huge number. all the way up is "5.1312805581556" and all the way down is "4.1333753849843". (its a mess) So basically if the text on the text label shows "5.1312805581556" then i want it to show "10". Here is my script because its not working.
"Data is the name of the text label"
local Value = script.Parent.Data.Text local function Value() if Value("5.1312805581556") then Value("10") end end local function Value() if Value == ("4.1333753849843") then Value = ("1") end end
You didn't fire the function
, a function that placed on the script is not working, else you fire them.
Some function tips:
A function is a thing that defines a specific code that's sandwiched inside the function code.
Function benefit is:
Change the specific code easier if an error occurs.
Make this code at the last of the script:
while wait() do Value() end
But that I have a problem that I don't know, does a function with the same name will fire at a same time that the code tell them to fire?
Fixing problems!
Maybe you should replace line 3 to 17 like this,
local function Value() if Value("5.1312805581556") then Value("10") elseif Value == ("4.1333753849843") then Value = ("1") end end
Hmmm... Looks something wrong...
Oh! It's the code!
The code line 2, see the problem?
Yeah, it's doesn't have double equals in it. And the code line 4 was not right, that have no equals so the value might not working!
Replace that code again:
local function Value() if Value == ("5.1312805581556") then Value = ("10") end elseif Value == ("4.1333753849843") then Value = ("1") end end
Something seems not right too...
The full code is like this:
local function Value() if Value == ("5.1312805581556") then Value("10") elseif Value == ("4.1333753849843") then Value = ("1") end end while wait() do Value() end
It seems not right too!
If the value was 5.1312805581556, the Value will be 10.
If the value was 4.1333753849843, the Value will be 1.
But what will happen when the Value was not 5.1312805581556 or 4.1333753849843? The Value might kept the same value!
So we must fix this out,
The full code:
local function Value() if Value > ("5.1312805581556") then Value("10") elseif Value < ("4.1333753849843") then Value = ("1") end end while wait() do Value() end
I type so much for helping you out, hope I helped you, if the code was correct, then accept my answer! We'll appreciate much :)
I haven't test this on Roblox studio yet, so if the script was error then tell me! Ask me question if you have anything don't know too!
Bye!