Color3Value expects a color3 value but thinks it got an instance

Hello! I’m trying to make a system where if you click a SurfaceGui’s imagebutton, it fires a remotevent to the server with the color3 value from the button’s BackgroundColor3 property, and assigns it to the Color3Value, the problem is that for some reason the server thinks that the color3 value is an instance, so it can’t assign it to the color3value I have.

Images of ingame dev console:

Client:

Server:

Local Script inside of StarterGui.ColorGui

local player = game:GetService("Players").LocalPlayer
local Colorgui = script.Parent
local players = game:GetService("Players")
local colorguievent = game.ReplicatedStorage.ColorGuiEvent


for i, button in ipairs(Colorgui.Frame:GetChildren()) do
	if button:IsA("ImageButton") then

		button.Activated:Connect(function()
			print("Button Clicked!")
			colorguievent:FireServer(player,button.BackgroundColor3)
			print(button.BackgroundColor3)
		end)
		
	end
end	

Function that controls the remoteevent inside of a script inside of ServerScriptService

colorguievent.OnServerEvent:Connect(function(controllerplayer, color)
			if controllerplayer == controller.Value and colorselectable.Value == true then
				colorselected.Value = color --The Color3Value inside of ReplicatedStorage
				colorselectable.Value = false 
			end
		end)

Oh, found it! When you fire server, you don’t have to send the player, as it’s securely passed internally on server. Remove the player argument in FireServer(), and the color will become the second argument in OnClientEvent.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.