I've made character creation GUI that stores your customised style and saves it. I want to take the saved data from the datastore so I don't have to customise my character again. How can I go about this? Also this is a server script
local DataStore2 = require(1936396537) DataStore2.Combine("Customization", "Shirt", "Pants") local function getData(player) local char = player.Character or player.CharacterAdded:Wait() local ShirtDS = DataStore2("Shirt") local shirt = char:WaitForChild("Shirt") shirt.ShirtTemplate = ShirtDS:Get() end getData()
Only error is: ServerScriptService.DataStore:7: attempt to index local 'player' (a nil value) Line 7 Maybe access the player in another way?
local DataStore2 = require(1936396537) DataStore2.Combine("Customization", "Shirt", "Pants") local function getData() local player = game.Player.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local ShirtDS = DataStore2("Shirt") local shirt = char:WaitForChild("Shirt") shirt.ShirtTemplate = ShirtDS:Get() end getData()