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

Multiplier is not a valid member of Folder???

Asked by 3 years ago

when i test play on Roblox studio, the log says this : Multiplier is not a valid member of Folder Stack Begin Script 'ServerScriptService.Stats', Line 21 Stack End And also the multiplier value does not show up in leaderstats

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("Clidat")

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Parent = player
    leaderstats.Name = "leaderstats"

    local Clicks = Instance.new("IntValue", leaderstats)
    Clicks.Name = "Clicks"
    Clicks.Value = DataStore:GetAsync(player.UserId) or 0

    local mult = Instance.new("IntValue", leaderstats)
    mult.Name = "Multiplier"
    mult.Value = DataStore:GetAsync(player.UserId) or 1
end)

game.Players.PlayerRemoving:Connect(function(player)
    local Clicks = player.leaderstats.Clicks
    local mult = player.leaderstats.Multiplier
    local dattosa = {
    Clicks.Value
    mult.Value
    }
    DataStore:SetAsync(player.UserId, dattosa)
end)

1 answer

Log in to vote
0
Answered by 3 years ago

You need to add a comma to your dattosa table.

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("Clidat")

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Parent = player
    leaderstats.Name = "leaderstats"

    local Clicks = Instance.new("IntValue", leaderstats)
    Clicks.Name = "Clicks"
    Clicks.Value = DataStore:GetAsync(player.UserId) or 0

    local mult = Instance.new("IntValue", leaderstats)
    mult.Name = "Multiplier"
    mult.Value = DataStore:GetAsync(player.UserId) or 1
end)

game.Players.PlayerRemoving:Connect(function(player)
    local Clicks = player.leaderstats.Clicks
    local mult = player.leaderstats.Multiplier
    local dattosa = {
    Clicks.Value,
    mult.Value
    }
    DataStore:SetAsync(player.UserId, dattosa)
end)


0
oh and also multiplier wouldn't show up too anhminh01997 7 — 3y
Ad

Answer this question