It’s because your trying to assign a Color3 value to a BrickColor value. You could do…
BrickColor.new(Color3.new(r, g, b))
It’s because your trying to assign a Color3 value to a BrickColor value. You could do…
BrickColor.new(Color3.new(r, g, b))
We’ve transfered him over to using Color3 value instead of BrickColor.
Printing the Color3 value also gives me the same result.
So this prints 0,0,0?
local char = script.Parent
local event = game.ReplicatedStorage.Customize.Events.BodyColour
local valueDefiner = game.ReplicatedStorage.Customize.Values.ColourValue
event.OnServerEvent:Connect(function()
print(valueDefiner.Value)
for i, part in pairs(char:GetChildren()) do
if part:IsA("BasePart") then
part.Color = Color3.fromRGB(valueDefiner.Value)
-- If that doesn't work, try this: part.Color = Color3.new(valueDefiner.Value)
-- If all fails try this: part.Color = valueDefiner.Value
end
end
end)
I cannot remember which approach is the correct.
--In my own game I have used
Part.Color = Color.fromRGB(ColorTable[R],ColorTable[G],ColorTable[B])
-- But that is due to me saving the color in their datastore
All 3 did not work for me. It also prints 0, 0, 0 in all of them as well.
Wait a second. Ofc it will print 0,0,0. You’re changing the colourValue from the client, not the server. If you wish to send the new colour to the server, you could send it through the RemoteEvent.
Edit: Just make sure to check on the server, that the color they’ve sent is a valid color, they have access to changing themself into. (or what they change color of)
Alright. So what your saying is that when the button is clicked on the client it changes the value on the server then grabs the value on the server and gives it to the player?
Edit: Basically Client → Server
. . . . . . . . . . . . . . . V ---- After ----> Server
What I am saying is, you should send the colorvalue in here:
--ClientScript
event:FireServer(colour)
And now for the server:
event.OnServerEvent:Connect(function(player,colour) -- First argument here will always be the player that sent the remote, all arguments comes after that like normal. So if player sent argument1 from client as "colour", then it will come up as argument2 on the server.
if typeof(colour) == "Color3" then -- Checks that it is a Color3 value, and not anything random sent by the client
-- Do colorchanging here
end
end)
You don’t even need the ReplicatedStorage colour value, if you only use it for the simple case of storing it temporarily, between client/server. (Because that is not really how it works)
Okay, I’m gonna work on that I’ll get back to you in 10ish minutes.
I’VE DONE IT!! What I did was make the LocalScript only fire the event, then add this ServerScript in the button:
local button = script.Parent
local event = game.ReplicatedStorage.Customize.Events.BodyColour
local valueDefiner = game.ReplicatedStorage.Customize.Values.ColourValue
event.OnServerEvent:Connect(function()
valueDefiner.Value = button.BackgroundColor3
end)
Good work, have a nice evening and happy scripting!
Quick Update:
I tried doing what you said to do because my fix wasn’t working too well and yours is much easier than what I did but now I am having the same problem where it prints 0, 0, 0 and sets their skin to 0, 0, 0
Hi!
And what have you tried so far?
What I did was give the colour through event:FireServer(colour)
You gotta check where the issue starts, you do this by printing the color value in the different places in your script.
Okay, it looks like the problem is the LocalScript because it’s printing 0, 0, 0 from there.
Do you have any idea what could be wrong?
local GUI = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
local player = game.Players.LocalPlayer
local char = player.Character
local event = game.ReplicatedStorage.Customize.Events.BodyColour
local button = script.Parent
button.MouseButton1Click:Connect(function()
local colour = Color3.fromRGB(button.BackgroundColor)
print(colour)
event:FireServer(colour)
end)
EDIT: Changing line 10 to local colour = button.BackgroundColor3
makes it change properly but it prints a Color3 value, how could I make it print RGB?
Hi,
Where are you changing the color? On the server? How does the client get that info?
The LocalScript (a child of a button) grabs the colour of the button, gives it to the server, and fires the colour changing with that colour.
And the server prints the color correctly?
Everything works properly it just prints the colour as a Color3 value (Example: 0.2334, 0.4321, 0.3874) instead of an RGB value (Example: 234, 124, 187)