Hello everyone, I have a game with custom characters i created using blender, and same thing with the accessories, hair, clothes, etc.
I’m still not entirely sure how to go about this process yet, though I’ve been trying to research serialization, Here is how my customization screen is set up:
(the save slots currently have no scripts inside of them ^)
here is some of the code inside of the hair buttons
local remote = game.ReplicatedStorage.CHARACTERCREATION.Remotes["Hair events"].WD.Hairevent10
local function dead(object)
object:Destroy()
end
script.Parent.MouseButton1Click:Connect(function()
remote:FireServer()
if game.Workspace["Clone morphs"]["false"]:FindFirstChild("hhair") then
local icky = game.Workspace["Clone morphs"]["false"]:FindFirstChild("hhair")
dead(icky)
end
local hair = game.ReplicatedStorage.CHARACTERCREATION["Cloneable acc"]["WD Hair"]["Long hair"]["Autumn girl"]:Clone()
hair.Name = "hhair"
hair.Parent = game.Workspace["Clone morphs"]["false"]
end)
this one below is for deleteing hair if thats important what so ever
local remote = game.ReplicatedStorage.CHARACTERCREATION.Remotes["Hair remove"]
local function dead(object)
object:Destroy()
end
script.Parent.MouseButton1Click:Connect(function()
remote:FireServer()
local hair = game.Workspace["Clone morphs"]["false"]:FindFirstChild("hhair")
dead(hair)
end)
there are two different “species” with their own respective versions of the accessories (although the same mesh for the most part) so i hope it wont be too much of a problem,
i would like for the save’s to work similarly to WCUE’s save slots if possible, atleast in the aspect of being able to see your oc, if not that then being able to name the slots.
i’ve never done stuff like this before, so i hope its alright if anyone wanting to help can explain a tad more in depth than you would with someone more experienced? if not thats alright.
Do you need help just figuring out how to format the data? The way I do it is give every character a uniqueID and then hold all the customization values in a table. For example below, the unique characterID’s CharacterLoadout table holds these following values. For Color, I just save the 0-1 RGB value and then set a name for what kind of item it is if that makes sense.
not just the format Per Se but also how i would exactly ID the characters,
But may i ask how to make a table in that kind of format? I’m still learning tables in my own time so its still a bit above my head if you get me lol!
Wrote a bit of code to help you get started and commented it too. Lmk if you need any more questions.
local HttpService = game:GetService("HttpService")
--this is set/get from your datastore
local playerSlots = {}
--this gives a unique id for your custom character
local uniqueID = HttpService:GenerateGUID(false)
print(uniqueID)
--add the reference to your playerSlot table
playerSlots[uniqueID] = {}
--table where the character loadout is held
--you can add whatever categories of items and colours you need here
playerSlots[uniqueID].characterLoadout = {
Pants = "jeans",
Shirt = "polo",
Hair = "wavy",
--Color table can be used for specific accessory colours
--Uses the RGB format so the colour below would be orange hair
Color = {
Hair = {
R = 255,
G = 127,
B = 0,
},
},
}
--you can also add other values to the playerSlot for your character, for example coins
playerSlots[uniqueID].coins = 100
playerSlots[uniqueID].specie = "vampire"
--printing the playerSlot here so you can see what the table would look like
print(playerSlots)
Oh this helps a lot! thank you so much!
one more question i have would be saving and loading,
i have a slight idea on how to do the loading part of the accessories, but for the saving part for the player and joining im not quite sure, i assume it requires using datastores which i know a little bit about.