How to make it so that the player can chose any RGB color for a tool?

“frame” is the local variable. Also, there were no errors in the console about the variables.

1 Like

Put the frame text inside of the fire server, then you can get it through the other end. Example: FireServer(frame.RBOX.Text, frame.GBOX.Text,frame.BBOX.Text) then OnServerEvent(R,G,B) make sure to add local variables for the frame son the client.

1 Like

Local scripts fire with
:FireServer()
and receive with
:OnClientEvent()

Server scripts fire with :FireAllClients()/:FireClient()
and receive with
:OnServerEvent
If that’s what you mean?

1 Like

Did you try changing these to tonumber()
image

tonumber(frame.RBOX.Text)

Also for the local script, there is a random “/“ on line 1.
So for the first script, use a localscript inside a textbutton

For the second script, use a server script in serverscriptservice

1 Like

You would actually use a client script in starter player scripts.

Changed those, still didn’t work.

You can use :MouseButton1Click() in SPS? Didn’t know that.

Is this good?

Event.OnServerEvent:Connect(function(R, G, B)

I don’t know if :OnServerEvent() can receive from local scripts.

Hold on be right back, gotta do dishes.

Yea it is good, but this is the server part. Make sure you also add the client part.

Just did, so next do i add a local variables for each of those letters inside?

No, they are the values already. Add variables for the frames in the client script.

Event:FireServer(script.Parent.Parent.RBOX.Text, script.Parent.Parent.GBOX.Text, script.Parent.Parent.BBOX.Text)

Yep! This will work, now I think you are done. Just so this if you haven’t already:


player.Character.Tool.Handle.Color = Color3.fromRGB(R,G,B)	

1 Like

Alright, but so I need to put tonumber()?

You can, or learn how to restrict your text box input to only numbers.

1 Like

Back and yeah, tonumber is probably the easier way to prevent letters from jumbling into your rgb numbers.

1 Like

To account for non-number values, expand from something like this:

Event.OnServerEvent:Connect(function()
	local r = tonumber(frame.RBOX.Text)
	if not r then return end
	local g = tonumber(frame.GBOX.Text)
	if not g then return end
	local b = tonumber(frame.BBOX.Text)
	if not b then return end
	player.Character.Tool.Handle.Color = Color3.fromRGB(r, g, b)
end)
1 Like

Also, why doesn’t it put the color correctly? It only puts G, B values.