hello there, I am an builder who want to make system that custom startercharacter saves the changed clothes that is worn inside the game and when startercharacter dies or rejoins, the clothing would save, I have searched for how to make that thing on roblox studio but had no luck other then this I found, there is some articles in scriptinghelpers site but I suck at scripts that I cannot understand it. anyway here is an link of that articles.
that one roblox scriptinghelpers article about how to save clothes in datastore
also in that article, there is two persons who have shown script or suggestion of script in that article, but I canāt understand those at this moment, anyway here is these scripts
(first page of script that Zoltra have posted first, it have errors of " error: ServerScriptService.clothesData:7: attempt to index nil with 'WaitForChild '"
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")
game.Players.PlayerAdded:Connect(function(player)
local shirtId = player.Character:WaitForChild("Shirt").ShirtTemplate
local pantsId = player.Character:WaitForChild("Pants").PantsTemplate
local data
local success, errormessage = pcall(function()
data = myDataStore:GetAsync(player.UserId, {shirtId, pantsId})
end)
if success then
shirtId = data[1]
pantsId = data[2]
else
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local shirtId = player.Character:WaitForChild("Shirt").ShirtTemplate
local pantsId = player.Character:WaitForChild("Pants").PantsTemplate
local success, errormessage = pcall(function()
myDataStore:SetAsync(player.UserId,{shirtId, pantsId})
end)
if success then
print ("Player Data successfully saved")
else
print ("Error saving data")
warn(errormessage)
end
end)
also the other script suggestion that VerdommeMan have posted in that article.
thatās all I could find of in that article, it was posted in 2 years ago and Iām trying to recover that thing to work, thank you peoples.
-mari