Color3 Wanted, got string. How to convert any string to color3?
I'm making a skin colour changer. It has a datastore and it saves the skin color that you choose to the datastore and changes skin color. When you rejoin the game it should spawn as the last skin colour you chose because it saves to datastore, but when I try to change the Character's body parts to that piece of data it says: Color3 wanted, got string.
01 | game.Players.PlayerAdded:Connect( function (plr) |
02 | local col = plr:WaitForChild( "Stats" ).Color.Value |
03 | local char = plr.CharacterAdded:Wait() |
04 | local colour = tonumber (col) |
06 | char.Head.Color = colour |
07 | char.Torso.Color = colour |
08 | char [ "Left Leg" ] .Color = colour |
09 | char [ "Left Arm" ] .Color = colour |
10 | char [ "Right Arm" ] .Color = colour |
11 | char [ "Right Leg" ] .Color = colour |
That's my current script for that.
This is what saves it to the datastore and this works fine:
01 | local DataStore 2 = require( 1936396537 ) |
03 | game.ReplicatedStorage.Events.ColourEvent 1. OnServerEvent:Connect( function (plr, colour) |
05 | local colorDataStore = DataStore 2 ( "color" , plr) |
06 | local char = plr.Character |
07 | local colour 2 = tostring (colour) |
09 | colorDataStore:Set(colour 2 ) |
11 | char.Head.Color = colour |
12 | char.Torso.Color = colour |
13 | char [ "Left Leg" ] .Color = colour |
14 | char [ "Left Arm" ] .Color = colour |
15 | char [ "Right Arm" ] .Color = colour |
16 | char [ "Right Leg" ] .Color = colour |
I have eight different colour types, and when you click it, it will fire event and send the background colour to the script. Then it saves to datastore. When a player leaves and rejoins it should make the skin colour what that datastore value is. (the colour)