Hi!
Right now I have a plot system, it doesn’t save though. I’m trying to get better at DataStores, but I still don’t know it very well yet. This is my Plot System.
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local BuildGui = PlayerGui:WaitForChild("Build")
local PlotGui = PlayerGui:WaitForChild("Plot")
--local PlayGui = PlayerGui:WaitForChild("Play_DevTest")
local PlotsFolder = game.Workspace:WaitForChild("Plots")
local PlotOn = 1
local function NewSaveSlot(ID, DataUsed, Name, Value)
local Clone = PlotGui:WaitForChild("SaveSelect"):WaitForChild("Template",5):Clone()
Clone.Parent = PlotGui:WaitForChild("SaveSelect"):WaitForChild("List")
Clone.Visible = true
Clone.Name = Name
local Main = Clone:WaitForChild("Main")
Main:WaitForChild("ID").Text = "Debug ID: "..ID
Main:WaitForChild("ItemCount").Text = DataUsed.."% Data Used"
Main:WaitForChild("PlotName").Text = Name
Main:WaitForChild("Worth").Text = "Worth FP$"..Value
end
--[[
PlayerGui:WaitForChild("WelcomeScreen"):WaitForChild("MainScreen"):WaitForChild("Play").MouseButton1Click:Connect(function()
--game:GetService("UserInputService").InputBegan:Connect(function(key)
-- if key.KeyCode == Enum.KeyCode.Q then
--PlayGui.Enabled = false
task.wait(2)
print("Play")
PlotGui:WaitForChild("SaveSelect").Visible = true
-- end
--end)
end)
]]
PlotGui:WaitForChild("SaveSelect"):WaitForChild("NewBtn").MouseButton1Click:Connect(function()
PlotGui:WaitForChild("SaveSelect").Visible = false
PlotGui:WaitForChild("NameSelect").Visible = true
end)
PlotGui:WaitForChild("NameSelect"):WaitForChild("OK").MouseButton1Click:Connect(function()
local Text = PlotGui:WaitForChild("NameSelect"):WaitForChild("Textbox").Text ~= "" and PlotGui:WaitForChild("NameSelect"):WaitForChild("Textbox").Text or Player.DisplayName.."'s Plot"
if #Text > 50 then Text = string.sub(Text, 1, 50) end
NewSaveSlot("FYTP-"..Player.UserId..math.random(11111,999999), "0", tostring(Text), "0")
PlotGui:WaitForChild("NameSelect").Visible = false
PlotGui:WaitForChild("SaveSelect").Visible = true
end)
Right now, I have the function NewSaveSlot. I’m planning on making them save by the ID, how would I do that?
Thanks!