I need help with my datastore script sorry if it’s a bit messy but there are two datastores in here and “TowerBool6” makes everything true when i add another variable Please help
Blockquote
local DataStore = game:GetService(“DataStoreService”)
local ds = DataStore:GetDataStore(“TowerStats6”)
local ds2 = DataStore:GetDataStore(“TowerBool6”)
game.Players.PlayerAdded:Connect(function(player)
local stats = Instance.new(“Folder”)
stats.Parent = player
stats.Name = “leaderstats”
local Tower = Instance.new(“IntValue”)
Tower.Name = “Towers”
Tower.Parent = stats
Tower.Value = ds:GetAsync(player.UserId) or 0
Tower.Changed:Connect(function()
ds:SetAsync(player.UserId, Tower.Value)
end)
end)
game.Players.PlayerAdded:Connect(function(player)
local Towerboolean = Instance.new(“Folder”)
Towerboolean.Parent = player
Towerboolean.Name = “TowerStats”
local tower1 = Instance.new("BoolValue")
tower1.Parent = Towerboolean
tower1.Name = "towerofaneasystart"
tower1.Value = ds2:GetAsync(player.UserId, tower1.Value) or false
local tower2 = Instance.new("BoolValue")
tower2.Parent = Towerboolean
tower2.Name = "toweroffewerfalls"
tower2.Value = ds2:GetAsync(player.UserId, tower2.Value) or false
local tower3 = Instance.new("BoolValue")
tower3.Parent = Towerboolean
tower3.Name = "towerofslightanger"
tower3.Value = ds2:GetAsync(player.UserId, tower3.Value) or false
local tower4 = Instance.new("BoolValue")
tower4.Parent = Towerboolean
tower4.Name = "towerofsplitwalls"
tower4.Value = ds2:GetAsync(player.UserId, tower4.Value) or false
local tower5 = Instance.new("BoolValue")
tower5.Parent = Towerboolean
tower5.Name = "towerofcavelevelclimbing"
tower5.Value = ds2:GetAsync(player.UserId, tower5.Value) or false
local tower6 = Instance.new("BoolValue")
tower6.Parent = Towerboolean
tower6.Name = "toweroffunnyjumps"
tower6.Value = ds2:GetAsync(player.UserId, tower6.Value) or false
local tower7 = Instance.new("BoolValue")
tower7.Parent = Towerboolean
tower7.Name = "towerofagony"
tower7.Value = ds2:GetAsync(player.UserId, tower7.Value) or false
tower1.Changed:Connect(function(player)
ds2:SetAsync(player.UserId, tower1.Value)
end)
tower2.Changed:Connect(function(player)
ds2:SetAsync(player.UserId, tower2.Value)
end)
tower3.Changed:Connect(function(player)
ds2:SetAsync(player.UserId, tower3.Value)
end)
tower4.Changed:Connect(function(player)
ds2:SetAsync(player.UserId, tower4.Value)
end)
tower2.Changed:Connect(function(player)
ds2:SetAsync(player.UserId, tower2.Value)
end)
tower5.Changed:Connect(function(player)
ds2:SetAsync(player.UserId, tower5.Value)
end)
tower6.Changed:Connect(function(player)
ds2:SetAsync(player.UserId, tower6.Value)
end)
tower7.Changed:Connect(function(player)
ds2:SetAsync(player.UserId, tower7.Value)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Towers.Value)
ds2:SetAsync(player.UserId, player.TowerStats.towerofaneasystart.Value)
ds2:SetAsync(player.UserId, player.TowerStats.toweroffewerfalls.Value)
ds2:SetAsync(player.UserId, player.TowerStats.towerofslightanger.Value)
ds2:SetAsync(player.UserId, player.TowerStats.towerofsplitwalls.Value)
ds2:SetAsync(player.UserId, player.TowerStats.towerofcavelevelclimbing.Value)
ds2:SetAsync(player.UserId, player.TowerStats.toweroffunnyjumps.Value)
ds2:SetAsync(player.UserId, player.TowerStats.towerofagony.Value)
end)
I’m sorry im new)