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

How can I get these individual save scripts to work?

Asked by 6 years ago

I am working on a way to save multiple values for items in my game without having them clog up the save limit saving them all at once by using a script inside each folder. I made the script but when I test it out nothing seems to happen. I think the problem is in the changed:connect bit but i'm not sure. Any help with this would be appreciated, here is the script:

local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local HatSource = DataStoreService:GetDataStore("Hats")
local player = script.Parent.Parent.Parent
local hatid = script.Parent.Name

script.Parent.Changed:connect(function()
    HatSource:SetAsync(player.UserId,hatid.Value) 
    print(hatid.."updated!")
end)

Answer this question