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?
Here's the correct answer.
script.Parent.Changed:connect(function() if tonumber(script.Parent.Text) < 24 and tonumber(script.Parent.Text) > 12 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)