How do i save plugin settings/Data

so i am making a plugin that have setting+automaticlly created stuff based on the use
i wanted to save those so the users willnot need to set up every thing again whenever they open a place

i though about saving them as json files but roblox studio doesnot allow that

i though about saving the settings as a module script in ServerStorage so it saves whenever the game is saved but i donot think this is a good idea because users can mess with it and break the plugin.

is there any better ways to save that?

any help is appreciated and thanks

2 Likes

using plugin:SetSetting() and plugin:GetSetting() is a good approach. and you can use HttpService:JSONEncode() and HttpService:JSONDecode() to convert your data to and from JSON strings(the datatype that is required for plugin:GetSetting() 's value). before saving and after loading.

1 Like

thank you i have looked into their documentations and they are what i need but i have 1 question
is there an event that fires when the user saves/closes the game? i think it would be better to save plugin data at that time instead of saving it when the player change a setting

I don’t think we are able to detect that yet but you can connect an event to plugin.Unloading, it runs when if the plugin is uninstalled or updated or closed

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.