Hey! I’m currently testing a power restoring system and as the player holds E the green Color3 goes up 1 every second blah blah blah. I want to check if the color3 value on the part is at least 0,100,0. Is this possible? I’ve tried multiple methods and all never work/error.
Could this work?
if part.Color.R > 100 then
-- your code
end
1 Like
Doesn’t seem to. May be my code:
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
if workspace.Power.Button.Color.G >= 15 then
game.ReplicatedStorage.RestorePower:FireServer()
warn("Power restored!")
else
warn(workspace.Power.Button.Color.G)
end
HoldTime = tick() - HoldTime
print(HoldTime)
Holding = false
workspace.Power.Button.Color = Color3.new(0,0,0)
--Green = 0
end
end)
Is the output just giving you 0 when prompted for the green value?
Yes it is printing 0. (Numbers) (CharacterLimit)
When you set a Color3, no matter if you use Color3.new() or Color3.fromRGB(), that Color3’s RGB values are numbers between 0 and 1, and not the 0-255 range that the explorer displays.
While I don’t understand why your button’s G value is 0, you should instead do something like this for comparing the color’s RGB values individually.
if workspace.Power.Button.Color.G >= 15/255 then
1 Like
What would be the way to transfer it into 0-255 if it’s 0-1?
You multiply by 255 to transfer it from 0-1
HOWEVER, because of rounding, this number may not be exact.
1 Like