Help with Color Value

Basically I am trying to make a points light color change. When the color numbers print, they print as I desire. Printed Output, 198,48,50 But the point light color comes out as, 0,198,48 | I expected the point light color to be 198,48,50

Local Script:

function fireRBG()
    
    local backgroundColor = script.Parent.BackgroundColor3
    local R = backgroundColor.R*255
    local G = backgroundColor.G*255
    local B = backgroundColor.B*255

    game.ReplicatedStorage.Color:FireServer(R,G,B)
    print(R,G,B)
    
script.Parent.MouseButton1Click:Connect(fireRBG)

end


Server Script:


**Server Script:**

game.ReplicatedStorage.Color.OnServerEvent:Connect(function(R, G, B)
    script.Parent.Color = Color3.fromRGB(R, G, B)
end)

1 Like

It’s because the first argument of .OnServerEvent is Player.

game.ReplicatedStorage.Color.OnServerEvent:Connect(function(player, R, G, B)
    print(player, 'fired this event!')
    script.Parent.Color = Color3.fromRGB(R, G, B)
end)

Your connection also isn’t set up properly.

local function fireRBG()
    local backgroundColor = script.Parent.BackgroundColor3
    local R = backgroundColor.R*255
    local G = backgroundColor.G*255
    local B = backgroundColor.B*255

    game.ReplicatedStorage.Color:FireServer(R,G,B)
    print(R,G,B)
end

script.Parent.MouseButton1Click:Connect(fireRBG)
3 Likes

Thank you for helping me, it worked.

1 Like

I added player to the function.

1 Like

just to expand on this, here is how they should work

RemoteEvent:FireServer(Data)

RemoteEvent.OnServerEvent:Connect(function(Player, Data)
end)
RemoteEvent:FireClient(Player, Data)

RemoteEvent.OnClientEvent:Connect(function(Data)
end)
2 Likes