Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I create a number count for a local value between 0 and 255?

-- In a LocalScript in StarterGui:

-- Create ScreenGui
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = script.Parent

-- Insert RGBlist number count on this line

-- Create ColorBox
local colorBox = Instance.new("Frame")
colorBox.Name = "Color"
colorBox.Parent = screenGui
colorBox.Position = UDim2.new(0, 0, 0.5, -75)
colorBox.Size = UDim2.new(0, 150, 0, 150)
colorBox.BackgroundColor3 = Color3.fromRGB(redValue,greenValue,blueValue)

-- Create RedValue
local redValue = 0

-- Create RedInput
local redInput = Instance.new("TextBox")
redInput.Name = "Red"
redInput.Parent = screenGui
redInput.Position = UDim2.new(0.5,-100,0.5,-75)
redInput.Size = UDim2.new(0,200,0,50)
redInput.BackgroundColor3 = Color3.new(255,0,0)

function redText()
	if redInput.Text <=0 or redInput.Text == ("-" .. math.random()) or redInput.Text == math.random() then 
		redValue = 0
	elseif redInput == RGBlist then
	end
end

redText()

I have the basics for a script, but I need to create a number count for a value between 0 and 255, and as well, make it so I can activate this function (redText()) as the text value changes on the text box rather than just once.

1 comment

0

Can you clarify this..?

1 answer

You're gonna need something like,

function checkColor(screengui) -- I think it is screengui, you might wanna check though.
	for i = 1, #Color do
		if color[i] == Color3 then -- Might wanna check this too
			return true
		end
	end
	return false
end

Also in mine, you might wanna check if there are too many ends. I am a bit sloppy with scripting, so good luck.

This discussion is preserved as it was. New answers, comments, and votes are closed.