#tower defense shop datastore and system
1 messages · Page 1 of 1 (latest)
to use datastore i really recommend using profilestore + replica services
how do I make one? also this is my datastore:
and tower containers
return {
Towers = {
Trooper = "Trooper",
Blaster = "Blaster"
},
Template = {
Money = 0,
TowersOwned = {"Trooper","Blaster"},
TowersEquipped = {}
},
Keys = {
["Money"] = "Money",
--["TowersOwned"] = "TowersOwned"
},
}
and player data: local self = {}
local DataStoreModule = require(game.ServerStorage.DataStore)
local players = game:GetService("Players")
local Enums = require(game.ReplicatedStorage.Enums)
local function stateChanged(state, Datastore: DataStoreModule.DataStore)
while Datastore.State == false do
if Datastore:Open(Enums.Template) ~= "Success" then task.wait(6) end
end
end
function self.initialize()
players.PlayerAdded:Connect(function(player)
local dataStore = DataStoreModule.new("Player", player.UserId)
dataStore.StateChanged:Connect(stateChanged)
stateChanged(dataStore.State, dataStore)
end)
players.PlayerRemoving:Connect(function(player)
local dataStore = DataStoreModule.find()("Player", player.UserId)
if dataStore ~= nil then dataStore:Destroy() end
end)
end
function self.start()
end
return self
hmmm
yeah the profilestore can do all of this but in a very simple way to use
and profilestore is already configured against dupes and everything else
i can help you setting up profilestore and replica if you want
suree
Im only a beginner so idk how stuff works
did you script all of those yourself?
or did you copy from youtube
or did you have help
cuz thats lowkey impressive
alr
and the loadout
keep finding help
ok
whats the bug?
When players rejoined their old leaderboard is kept and not removed I tried fixing it but it doesnt detect player lesving
doesnt detect?
yeah
old leaderboard is kept?
like the leaderboard status
the thing where it shows player name and cash
why
it duplicates?
i dont undersatnd lol
yeah when they join multiple times
idk I suck at explaining
so when they join
they get coin
right?
or what
nah its fine im farming lvl 15
no like the framee
it stays when they leave and when they join back a new frame is added and it is duplicated
(Idk why we r talking about this lol, even though the main topic is shop sys)