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

How would i make this Filtering Enabled?

Asked by
oSyM8V3N 429 Moderation Voter
6 years ago

Im having trouble making this Datastoring script Filtering Enabled. Any idea on what to add to make it do so?

local DSService = game:GetService('DataStoreService'):GetDataStore('DBSRData')
game.Players.PlayerAdded:connect(function(p)
    wait(2.5)
    -- Define variables
    local stats = game.ServerStorage.Data:Clone()
    stats.Parent = p
    local uniquekey = 'id-'..p.userId
    local names = {}

    for i, v in pairs(p.Data:GetChildren()) do
        table.insert(names, v.Name)
    end

    -- GetAsync
    local GetSaved = DSService:GetAsync(uniquekey)
    if GetSaved then
        for i, v in pairs(p.Data:GetChildren()) do
            v.Value = GetSaved[i]
        end

        for i=1, #GetSaved do
                --print(i .. ": " .. names[i] .. " = " .. tostring(GetSaved[i]))
        end
    else
        local NumbersForSaving = {}
            for i, v in pairs(p.Data:GetChildren()) do
                table.insert(NumbersForSaving, v.Value)
            end
        DSService:SetAsync(uniquekey, NumbersForSaving)
    end
end)

game.Players.PlayerRemoving:connect(function(p)
    local uniquekey = 'id-'..p.userId
    local Savetable = {}
        for i, v in pairs(p.Data:GetChildren()) do
            table.insert(Savetable, v.Value)
        end

    DSService:SetAsync(uniquekey, Savetable)            
end)

2 answers

Log in to vote
0
Answered by 6 years ago

Hi! What I would recommend you do is put that code into a service script if you have not done so already. If it has to be a local script then here is a guide from the Roblox Wiki to help you out. Hint* If it's from a local script you will be needed to use RemoteEvents or RemoteFunctions.

RemoteEvents and RemoteFunctions: http://wiki.roblox.com/index.php?title=Remote_Events_and_Functions

Ad
Log in to vote
-1
Answered by 6 years ago

I recommend you turning off filtering enabled. Filtering enabled is to stop hackers from getting into your game.

0
Disabling FilteringEnabled is bad practice. Games without FE aren't allowed on the front page. It's also better to learn how to use FE at the beginning, rather then trying to add it in at the end of the project. Dog2puppy 168 — 6y

Answer this question