xxibadrxx
(xxibadrxx)
March 1, 2023, 8:25pm
1
Title is self explantory
local colors = {
Color1 = Color3.fromRGB(77, 59, 48),
Color2 = Color3.fromRGB(160, 132, 79),
Color34 = Color3.fromRGB(199, 172, 120),
Color4 = Color3.fromRGB(27, 42, 53),
Color5 = Color3.fromRGB(108, 88, 75),
Color6 = Color3.fromRGB(226, 155, 64)
}
function color3torgb(color3)
return color3.R*255,color3.G*255,color3.B*255
end
function FindWhichColor(ColorName)
for _,v in pairs(colors) do
if ColorName == Color3.new(color3torgb(v)) then
return true
else
print(ColorName)
print(Color3.new(color3torgb(v)))
end
end
end
game.ReplicatedStorage.Events.ColorHandler.OnServerEvent:Connect(function(player, Mustache, ColorFromRGB)
print("fired")
if FindWhichColor(ColorFromRGB) == true then
local x = FindWhichColor(ColorFromRGB)
print(x)
else
player:Kick("Exploiter")
end
end)
I think because it isn’t boolean.
Problem.
The problem is only on the line: if ColorName == Color3.new(color3torgb(v)) then.
the v is already a Color3.fromRGB value. Just do this:
if ColorName == v then
xxibadrxx
(xxibadrxx)
March 1, 2023, 8:33pm
4
Mind you explain more? that is not really making sense
xxibadrxx
(xxibadrxx)
March 1, 2023, 8:34pm
5
I have done that before v returns as a color3 value instead of RGB value for some reason
is ColorName an RGB or Clamped color?
xxibadrxx
(xxibadrxx)
March 1, 2023, 8:37pm
7
Mind you tell me wdym by “Clamped color”?
LeePha
(LeePha)
March 1, 2023, 8:38pm
8
do print(typeof(ColorName)) and the other one, == checks if both values are the same for example “1” ~= 1 because one is a string one is a number.
1 Like
Clamped is the 0-1 and RGB is 0-255
xxibadrxx
(xxibadrxx)
March 1, 2023, 8:39pm
10
It is RGB it is clearly showing in output printed as RGB
I am not sure about that, but you have error in table:
local colors = {
Color1 = Color3.fromRGB(77, 59, 48),
Color2 = Color3.fromRGB(160, 132, 79),
Color34 = Color3.fromRGB(199, 172, 120),--here is error you named it Color34 instead Color3
Color4 = Color3.fromRGB(27, 42, 53),
Color5 = Color3.fromRGB(108, 88, 75),
Color6 = Color3.fromRGB(226, 155, 64)
}
xxibadrxx
(xxibadrxx)
March 1, 2023, 8:41pm
12
I just tried that, it printed “Color3”
Oh wait to think I see your problem now, it’s already printing true but for every color it’s not it prints the else.
LeePha
(LeePha)
March 1, 2023, 8:44pm
14
Have you printed out the types of both of them - are both Color3 Objects?
xxibadrxx
(xxibadrxx)
March 1, 2023, 8:44pm
15
But why x value did not print for me
I have no idea, try using warn instead of print and look for orange text
And about i am not sure: in line 27 you have
if FindWhichColor(ColorFromRGB) == true then --maybe you need to delete true and ==
xxibadrxx
(xxibadrxx)
March 1, 2023, 8:46pm
18
I just tried it there is nothing in the output meaning it did not come as true value
Alright let me get 1 last info and try to go recreate the script from scratch. The remote event color. Is that also RGB?
game.ReplicatedStorage.Events.ColorHandler.OnServerEvent:Connect(function(player, Mustache, --> ColorFromRGB <--)
1 Like
xxibadrxx
(xxibadrxx)
March 1, 2023, 8:49pm
20
Yeah it is RGB I also did print it to make sure.