Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this Color3 not work properly? "Color cannot be assigned to"

Asked by 4 years ago

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.

0
I don't know if this will work, but try changing 'color' in replicatedStorage to Color3.fromRGB(Value of color) B_rnz 171 — 4y
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. develop_d 53 — 4y
0
Try Color3.fromRGB instead of Color3.new Dalbertjdplayz 37 — 4y
0
I did use Color3.fromRGB develop_d 53 — 4y
0
Try printing the "part" argument, like so: print(part.Name), and tell us what the output says. Y_VRN 246 — 4y

Answer this question