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.
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.
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.
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…