Hulp with saving properties in a plugin

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I will make a plugin with settings and different options to set up let’s skip the details
  2. What is the issue? Include screenshots / videos if possible!
    So I want to save the properties from the ui in the script where it change
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? I searched everywhere nothing found

I will if it can that I can customise it that it save in game to data store or profile service but I think I only should change the save way but for now I need to know how to do this on a plugin

--like 
Local button = script.parent.etc

Local function or script.parent.mouseclick etc
Script.pareng.button . Visible= false 
Button.backtra = 0.1 
Button.color = #137347

-- so a function but here it save the state from this properties it can on different ways like when button is clicked or in other functions but idk how save this so when you leave studio and restart it have the same properties as what the script changed 

[Edit]
We use the plugin get settings and set settings to save it to an json on users pc i recommend use tables cuz it makes you read the Jason beter also cuz of Jason we only can store strings, numbers, Booleans but things like vector3 etc can you also save in a string format like “0.6, 6, 8” then we use the , to split the string and convert it to a vector3

This solution mentions plugin:GetSetting() and plugin:SetSetting()

When the plugin is loaded, you can just check the settings and update the variables in the script. If no setting exists, set it to the default variable.


local RAN_BEFORE_KEY = "RanBefore"
local didRunBefore = plugin:GetSetting(RAN_BEFORE_KEY)

if didRunBefore then
Script.parent.visible = true
Script.trandp =0.5
Etc 
	print("Welcome back!")
else
	plugin:SetSetting(RAN_BEFORE_KEY, true)
	print("Welcome! Thanks for installing this plugin!")
end

--somting like this


-- Or 

local RAN_BEFORE_KEY = "RanBefore"
local didRunBefore = plugin:GetSetting(RAN_BEFORE_KEY)

Function
Script.parent.visible = true
Script.trandp =0.5
Etc 

if didRunBefore then
	print("Welcome back!")
else
	plugin:SetSetting(RAN_BEFORE_KEY, true)
	print("Welcome! Thanks for installing this plugin!")
end

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