Colourwheel GUI does not work for multiple players

So i’ve found a colourwheel gui and altered it so that players could use it as a tool to colour a clothing item on their avatar as desired, and it seemed to work smoothly, untill i play-tested the game with a friend.

Whilst the item for the player wearing it would have it’s colour changed, for other players the colour just does not show up, despite the part’s colour changing in the properties tab. I’ve tried using other colourwheelgui’s but they all seemed to have the same issue for me.

perspective of player 1, who selected a clothing item and coloured it.

perspective of player 2, who is looking at player 1. for them, the colour of the sweater remains it’s default colour (in this case, white.)

Even though i’m mostly clueless (and infuriated) at this issue, i do have a running theory that the script works this way because the script takes place in the individual players GUI, so it will only apply to them.

How do i alter the script so that all players can see the colourwheels chosen colour? my understanding of coding was and still is still very surface-level, so any extra given instructions with a solution would be appreciated.

Here is the link to the original colourwheel i used as a template for mine:
Colour Wheel - Creator Marketplace (roblox.com)

And here is the complete Colourwheelgui that i made:
ColourwheelGUI - Roblox

Thanks in advance!

I’m going to assume that the GUI that you found is handled entirely on the client, you would need to set up a remote event to display the color of the player to everyone else in the server. When the player changes color from the LocalScript, fire the remote event using the local player as the argument and then a ServerScript would change the color of the player.

2 Likes

that sounds like a good idea! But, how do i do that, exactly?

could you show me some examples? i’ve never worked with remote events before, nor serverscipts.

Sure, I’ll run it down for you.

First, in ReplicatedStorage create a new RemoteEvent object, and title it “colorChange.” In both the client/server script, you can access this event with

local colorEvent = game:GetService("ReplicatedStorage"):WaitForChild("colorChange")

In the local script, you would activate this event by using a FireServer function.
Example:

local colorEvent = game:GetService("ReplicatedStorage"):WaitForChild("colorChange")

local newColor = Color3.fromRGB(255,0,0)

colorEvent:FireServer(game.Players.LocalPlayer, newColor)

Then to receive this event on the server, the ServerScript would listen for OnServerEvent, and fire a function from that.
Example:

local colorEvent = game:GetService("ReplicatedStorage"):WaitForChild("colorChange")

local function changeColor(player, newColor)
   player.Character.Head.Color = newColor
end

colorEvent.OnServerEvent:Connect(changeColor)

Hopefully you can figure out how to set this up with the GUI that you found.

You can also reference the documentation if anything confuses you: RemoteEvent | Roblox Creator Documentation

ill try to see what i can do with this later!

i hope that this works!

ive placed the second code block into a script but now im a bit confused as to where i need to put the third one…

The third block would go into a ServerScript inside of ServerScriptService.

i’ve attempted to edit the colourwheel script to cooperate with the other code but it doesnt seem to work…

could i maybe send you the altered scripts so you could see what the issue is? i feel like theres just a small error but i cant find out how to fix it

here is what i managed to came up with:

Ze colourer - Roblox
(apologies for the silly name, i’m suffering from a terrible tooth ache right now and thinking is a little hard)

Your model is offsale. Also, it’s a pretty simple implementation as I feel that I was extremely clear with my examples:

Please brush up on lua basics, and additionally please do not ask me to write scripts for you.

image

it seems like i got the script working! just… not as intended.

i tried altering the script to instead, colour the named accesory the player is wearing, but it didnt work.

here is what the serverscript looks like:

local colorEvent = game:GetService("ReplicatedStorage"):WaitForChild("colorChange")

local function changeColor(newColor)
	

	
end

colorEvent.OnServerEvent:Connect(changeColor)

despite not putting anything between the function in the serverscript, the script decides to still colour the head of the player with the colourwheel, somehow. inserting anything else into the script seems to break it.

There might also be an error in the local script part, but as far as ive seen this part seems to be working well.

local colorEvent = game:GetService("ReplicatedStorage"):WaitForChild("colorChange")

	local newColor = hsv   -- the colourwheels selected colour

	colorEvent:FireServer(newColor)

how would i fix this? i seriously have no idea how this is even happend…

You forgot to pass the player argument in the function, change it to this and it will work:

local function changeColor(player, newColor)

it works! but… the head still colours with the clothing item. and thats definately not what we want when creating a character…

i did not add or remove anything from the script so how is this happening?

Change the head to whatever you want to color in the function.

You probably left this in, this was just an example. Please mark my post as solution since it worked, and the topic will be closed.

fixed! thank you so much for your help, i will mark this questionaire off as solved!

i will be sure to credit you for your help! thank you so much ^^

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.