I’m making a tool save script it works but when i get another tool it doesnt delete the other tool is there a way to delete the other tool?
local DataStoreService = game:GetService("DataStoreService")
local toolSave = DataStoreService:GetDataStore("toolSave2")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Folder = ReplicatedStorage:WaitForChild("Shields")
game.Players.PlayerAdded:Connect(function(plr)
local toolName = Instance.new("StringValue")
toolName.Parent = plr
toolName.Name = "toolName"
local LoadSave = toolSave:GetAsync(plr.UserId) or ("Starter Shield")
toolName.Value = LoadSave
local shieldclone = Folder:WaitForChild(LoadSave):Clone()
shieldclone.Parent = workspace:WaitForChild(plr.Name)
toolName.Changed:Connect(function()
toolSave:SetAsync(plr.UserId, toolName.Value)
for i, shields in pairs(Folder:GetChildren()) do
local newshield = Folder:WaitForChild(toolName.Value):Clone()
newshield.Parent = workspace:WaitForChild(plr.Name)
end
end)
end)