local GamePassService = game:GetService('MarketplaceService')
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Down:connect(function()
if player:IsInGroup(5770388) or GamePassService:UserOwnsGamePassAsync(player.userId, 4702761) then
game.ReplicatedStorage.GUI.Assign:FireServer(BrickColor.new("Mint"))
end
end)
I don’t think color values work like that. Explained by @Blockzez. Have you tried using strings instead and adding the BrickColor value to the elements of the table?
I was just thinking of something along those lines. Now to edit 1000 local scripts haha, only got about 24 minutes to do all of this before I got to go IRL as well; oh boy.
table indexes only gets the index if they rawequal. As color values in Roblox Lua are objects, rawequal compare by them objects. Brick colors have the __eq metamethod so despite thatBrickColor.new("Mint") == BrickColor.new("Mint") is true, rawequal(BrickColor.new("Mint"), BrickColor.new("Mint")) is false so they don’t get the index of that value.
local color1 = BrickColor.new("Mint")
local color2 = BrickColor.new("Mint")
local t = { [color1] = "Mint" }
print(t[color1]) --> Mint
print(t[color2]) --> nil
print(color1 == color2) -- true
print(rawequal(color1, color2)) --> false
print(rawequal(color1, color1)) --> true
The problem OP is that the OP creates a table with different brick color object than the remote event sent despite them logically being the same. You’re correct that strings works.