So I have this script in a LocalScript inside a tool:

while wait() do
	if script.Parent.Holding.Value ~= nil then
		if script.Parent.Holding.Value == "ZM-3" then
			game.ReplicatedStorage.Events.ChangeHoldColor:FireServer(Color3.fromRGB(0, 255, 0), script.Parent)
		end
		if script.Parent.Holding.Value == "ST-14" then
			game.ReplicatedStorage.Events.ChangeHoldColor:FireServer(Color3.fromRGB(255, 255, 0), script.Parent)
		end
		if script.Parent.Holding.Value == "SM-P2" then
			game.ReplicatedStorage.Events.ChangeHoldColor:FireServer(Color3.fromRGB(0, 255, 255), script.Parent)
		end
		if script.Parent.Holding.Value == "ZD-6" then
			game.ReplicatedStorage.Events.ChangeHoldColor:FireServer(Color3.fromRGB(0, 0, 255), script.Parent)
		end
		if script.Parent.Holding.Value == "L3-STD" then
			game.ReplicatedStorage.Events.ChangeHoldColor:FireServer(Color3.fromRGB(255, 0, 0), script.Parent)
		end
		if script.Parent.Holding.Value == "LT-5Z" then
			game.ReplicatedStorage.Events.ChangeHoldColor:FireServer(Color3.fromRGB(85, 85, 0), script.Parent)
		end
	else
		game.ReplicatedStorage.Events.ChangeHoldColor:FireServer(Color3.fromRGB(255, 255, 255), script.Parent)
	end
end

I have an event in Events folder in ReplicatedStorage and I have this script in ServerScriptService for it:

game.ReplicatedStorage.Events.ChangeHoldColor.OnServerEvent:Connect(function(color, part)
	part.Color = color
end)

The tools work fine but the color doesn't change and I get this error:

18:08:51.099 - Color cannot be assigned to 18:08:51.101 - Stack Begin 18:08:51.103 - Script 'ServerScriptService.HoldColor', Line 2 18:08:51.105 - Stack End

Please help if you know how to fix this error or what causes it.

5 comments

0

I don't know if this will work, but try changing 'color' in replicatedStorage to Color3.fromRGB(Value of color)

0

I tried that a couple of minutes ago and it doesn't work or it works only on the server and the player can't see it.

0

Try Color3.fromRGB instead of Color3.new

0

I did use Color3.fromRGB

0

Try printing the "part" argument, like so: print(part.Name), and tell us what the output says.