Im trying to make it so the player can change his bodycolor and it saves when he joins.
When I print the the R,G,B values of color3, The values are abnormal
This is how im storing it:
local DataStore = game:GetService("DataStoreService")
local Data = DataStore:GetDataStore("PlayerColor")
game.ReplicatedStorage.LoadColors.OnServerEvent:Connect(function(ID, R,G,B)
local Table = {R,G,B}
print(Table)
Data:SetAsync(ID, Table)
end)
This is how I load it:
local success, Color = pcall(function()
return Data:GetAsync(PlrID) or {248,248,248}
end)
if success then
local R = Color[1]
print(R)
local G = Color[2]
print(G)
local B = Color[3]
print(B)
When I multiply it by 255 (all values) I turn completly black for some reason.
When I Use Color3.new(table.unpack(Color)) I turn completly blue. But when i do Color3.FromRBG(table.unpack(Color)) I turn red even when I will save it as white.
If you still want to use the RGB (255) values then you’ll have to show us your script where you call the function to save it to see what you’re doing wrong there.
The problem is coming from the script that fires the server event that you have shown us.
Heres a script that might help. Its realated but all it does is get the R,G,B
local BodyColor = game.ReplicatedStorage.CharacterColors.Red["Body Colors"].HeadColor3 --Gets the red HeadColor3
local PlrID = game.Players.LocalPlayer.UserId
local Char = game.Players.LocalPlayer.Character
local NewBodyColor = {BodyColor.R,BodyColor.B,BodyColor.G}
local ColorSaver = game.ReplicatedStorage.SaveColors
local ColorLoader = game.ReplicatedStorage.LoadColors
script.Parent.MouseButton1Click:Connect(function()
ColorSaver:FireServer(PlrID, BodyColor.R, BodyColor.G, BodyColor.B)
wait(0.1)
ColorLoader:FireServer(PlrID, BodyColor.R, BodyColor.G, BodyColor.B)
end)
Well you are sending those numbers with the fireserver, so I guess you need to add more print statements to see where it is not doing what you think it is doing.
Although I wouldn’t reccomend manually sending the ID since then exploiters could replace that with anyones ID and mess up someone elses data. You can just get the ID from the player object that is sent with Player.UserId and remove the ID parameter entirely.