#tower defense shop datastore and system

1 messages · Page 1 of 1 (latest)

rigid thunder
#

i really need help on making the shop system and datastore (basically adding purchase, equip, unequip system.

and making it so the towers I have in my loadout will also be applied in the main game

#

AND yes I will pay

#

(gamepass method)

austere wolf
rigid thunder
#

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

austere wolf
#

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

rigid thunder
#

Im only a beginner so idk how stuff works

quiet lotus
#

or did you copy from youtube

#

or did you have help

#

cuz thats lowkey impressive

rigid thunder
#

but I still need to finish the shop sys

quiet lotus
#

alr

rigid thunder
#

and the loadout

quiet lotus
#

keep finding help

rigid thunder
#

ok

quiet lotus
#

its not the best way

#

but you'll get the job done

#

soon

rigid thunder
#

and this duplicating bug

#

not 1 year.

quiet lotus
rigid thunder
# quiet lotus whats the bug?

When players rejoined their old leaderboard is kept and not removed I tried fixing it but it doesnt detect player lesving

rigid thunder
#

yeah

quiet lotus
#

old leaderboard is kept?

rigid thunder
#

player leaving**

#

yes

quiet lotus
#

that means you stored

#

the data

rigid thunder
#

like the leaderboard status

quiet lotus
#

what status

#

🙏

rigid thunder
quiet lotus
#

it duplicates?

#

i dont undersatnd lol

rigid thunder
#

idk I suck at explaining

quiet lotus
#

they get coin

#

right?

#

or what

quiet lotus
rigid thunder
#

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)

quiet lotus
#

oh

#

just go through the frame

#

delete it once the player leave