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.