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

How do I make this work with filtering enabled? [closed]

Asked by 7 years ago
local level = game:GetService("DataStoreService"):GetDataStore("Levels")
local xp = game:GetService("DataStoreService"):GetDataStore("XP")
local axp = game:GetService("DataStoreService"):GetDataStore("AXP") -- amount of XP Needed

function savedata(dataname, playerid, value)
    game:GetService("DataStoreService"):GetDataStore(dataname):SetAsync(playerid, value)    
end



game.Players.PlayerAdded:connect(function(player)
    local leader = Instance.new("Folder")
    leader.Name = "leaderstats"
    leader.Parent = player
    local levelz = Instance.new("IntValue")
    levelz.Value = level:GetAsync(tostring(player.userId)) or 1
    levelz.Name = "Level"
    levelz.Parent = player:WaitForChild("leaderstats")
    local xpz = Instance.new("NumberValue")
    xpz.Value = xp:GetAsync(tostring(player.userId))
    xpz.Name = "XP"
    xpz.Parent = player
    local xpn = Instance.new("IntValue")
    xpn.Value = axp:GetAsync(tostring(player.userId)) or 700
    xpn.Name = "XpNeeded"
    xpn.Parent = player

    xpz.Changed:connect(function()
        if player:WaitForChild("XP").Value >= player:WaitForChild("XpNeeded").Value then
            levelz.Value = levelz.Value+1
            xpn.Value = xpn.Value+700
            savedata("Levels",player.userId,levelz.Value)
            savedata("XP",player.userId,xpz.Value)
            savedata("AXP",player.userId,xpn.Value)
        else
            savedata("Levels",player.userId,levelz.Value)
            savedata("XP",player.userId,xpz.Value)
            savedata("AXP",player.userId,xpn.Value)         
        end
    end)
end)

game.Players.PlayerRemoving:connect(function(player)
    savedata("Levels",player.userId,player.leaderstats.Level.Value)
    savedata("EXP",player.userId.player.EXP.Value)
    savedata("AXP",player.userId.player.XpNeeded.Value)
end)
0
If this is a server script, Filtering should not affect it. hiimgoodpack 2009 — 7y
0
But it does. Bryson467 12 — 7y
1
How exactly do you think FE affects this script? What happens differently? BreadyToCrumble 121 — 7y

Closed as Non-Descriptive by adark, hiimgoodpack, Void_Frost, and PyccknnXakep

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?