Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Did Filtering Enabled Break my DataStore?

Weird problem. My Backpack is only saving 7 items now. Anything purchased after that disappears after the player dies. The only thing I've changed recently is turning on Filtering Enabled. Did turning this on break my Data Store script? If so, how do I fix it?

Here's my script below:

--Setup the DataStore
	local ds = game:GetService("DataStoreService"):GetDataStore("REMOVED");
	local tools = game.ServerStorage.ToolStorage; --Specify all possible tools
	
	--{[Check and Load]} 
game.Players.PlayerAdded:connect(function(plr)

	--Retrieve the potential data
	local data = false
	print("DataStoreBackSave1")
	plr.CharacterAdded:connect(function(char) -- this will run everytime the Player's Character has been added in workspace.
		if not data then
			data = ds:GetAsync(plr.UserId);
		end
		
		if data then
			--If it does, loop and clone respective tools.
			for _,v in next,data do
				local tool = tools:FindFirstChild(v);
				if tool then
					tool:Clone().Parent = plr.Backpack;
				end
			end
		end
	end)
end)


--{[Collect and Save]}

game.Players.PlayerRemoving:connect(function(plr)
	
    --Make a table to hold all the data
    local toolList = {};

    --Iterate through the backpack and fill the table in

    for _,v in next,plr.Backpack:GetChildren() do
        --Make sure it's actually a tool

        if v:IsA("Tool") or v:IsA("HopperBin") then
            toolList[#toolList+1] = v.Name;
        end
    end
    --Save the table

    ds:SetAsync(plr.UserId,toolList);
end)
print("DataStoreBackSave2")

1 comment

0

A data store is server side only so FE will not effect it in any way but FE may effect how the save process can be triggered and may require the use of a remote event.

1 answer

Yes, since its filtering enabled, when the player's data changes its only doing it for the client not the server. So u need to add remote events/functions to make it work.

6 comments

0

Thanks for the confirmation! I confess, I'm not sure how to do that. I never worked with remote events. Can you help me out a bit with this? :) Thank you again.

0

I would love to, but i am having problems with it myself. But if i do find a breakthrough, i'll be sure to let you know :)

0

A data store will only work on the server side, It is not effected by FE.

0

Look on the wiki.

0

I've looked on the wiki, and didn't understand how to use them. =/ Remote Events confuse me.

0

Check out a video on youtube about Filtering Enabled by 'PeasFactory", he's the one who taught me to use em. And +kingdom5, if you want to change the clients value's through a localscript you need to use Remote Events

This discussion is preserved as it was. New answers, comments, and votes are closed.