Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

This question already has an answer here:

How to work this IntConstrainedValue into a function?
-- 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.

0
Can you clarify this..? shayner32 478 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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.

Ad

Answer this question