I have made a script that can change the ammo of a gun in a gui. The gui is set up but the problem is it won't change the colors of the text. It does it once in the script.
how would i make this where is ammo was under 12 it because red?
script.Parent.Changed:connect(function()
if tonumber(script.Parent.Text) < 24 then
script.Parent.TextColor3 = Color3.new(255, 255, 0)
elseif tonumber(script.Parent.Text) < 12 then
script.Parent.TextColor3 = Color3.new(255, 0, 0)
else
script.Parent.TextColor3 = Color3.new(0, 255, 0)
end
end)
It's the if part, the first part, that works but the elseif doesn't work. I've tried it with a space in between but it still doesn't work. How could I fix it to make it work on both below 24 and 12?

4 comments
12 is below 24, so...
Color3.new() takes in values from 0-1. You are setting it at 255. Either divide the desired colour with 255 like this, (255/255, 0, 255/255), or simply put 1 to represent the whole number, like this (1, 0, 1); Additionally, if you dont want to have decimal numbers, consider switching over to
Color3.fromRGB().Ye but the if statement will return true if it is less than 24 thus the elseif not running
Delete your first comment and create a new comment / answer explaining both of these things then. TOo lazy to make a whole answer out of this.