Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to reference a folder that I do not have the excact name to?

Asked by 4 years ago
Edited 4 years ago

I'm building my data store for my game, and the name of the folder that stores the players data is there user id, but I now don't know how to reference it, so that I can add values to the save file.

local function addRequiredParts(player)
    local playerID = player.UserId
    local Location = game.ReplicatedStorage.playerData.playerID.givenValues
    local tempVar = Instance.new("BoolValue")
    tempVar.Name = "newPlyr"
    tempVar.value = false
    tempVar.Parent = Location
    tempVar = nil
    local tempvar = Instance.new("NumberValue")
    tempvar.Name = "forceMastery"
    tempvar.value = nil
    tempvar.Parent = Location
    tempvar = nil
    local tempvar = Instance.new("NumberValue")
    tempvar.Name = "forceEndurance"
    tempvar.value = 100
    tempvar.Parent = Location
    tempvar = nil
    local tempvar = Instance.new("BoolValue")
    tempvar.Name = "usingForce"
    tempvar.value = false
    tempvar.Parent = Location
    tempvar = nil
    local tempvar = Instance.new("NumberValue")
    tempvar.Name = "forceSrength"
    tempvar.Value = nil
    tempvar.Parent = Location
    tempvar = nil
end

game.Players.PlayerAdded:Connect(function(player)
    local newData = Instance.new("Model")
    local playerID = player.UserId
    newData.Name = (playerID)
    newData.Parent = game.ReplicatedStorage.playerData
    local playerValues = Instance.new("Model")
    playerValues.Name = "givenValues"
    playerValues.Parent = newData
    addRequiredParts(player)
end)
0
Can’t you use their userid to find the folder back again? I think that’s how it normally works OBenjOne 190 — 4y

Answer this question