#a problem with a shop
66 messages · Page 1 of 1 (latest)
give me a second
game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("IntValue", p)
stats.Name = "leaderstats"
local money = Instance.new("IntValue", stats)
money.Name = "Cash"
money.Value = 0
while true do
wait(1)
money.Value = money.Value + 1
end
end)
** You are now Level 4! **
Server or local script?
you mean, where its the script located?
its on ServerScriptService
uhmm, well, i really dont know the diference- (srry)
.
When you added the script
Did you add a "Script" or "LocalScript"
or when you click on the script at the top of the properties tab what does it say
white
So it's a server script
Why TF is your leader stats an int value
game.Players.PlayerAdded:Connect(function(player)
local stats = Instance.new("Folder", player)
stats.Name = "leaderstats"
local money = Instance.new("IntValue", stats)
money.Name = "Cash"
money.Value = 0
while true do
task.wait(1)
money.Value = money.Value + 1
end
end)
just some smal things fixed
but idk what could be wrong
the script works
the thing that im trying its, make it work with my another script about the shop
show me the shop script
there are a few scripts related to the shop
then the one where you handle buying the things
im searching it
but i really dont remember where it was-
maybe this one
local DataStoreService = game:GetService("DataStoreService")
local MyDataStore = DataStoreService:GetDataStore("MyDataStore")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Parent = leaderstats
local data
local success, errormessage = pcall(function()
data = MyDataStore:GetAsync(player.UserId.."-coins")
end)
if success then
coins.Value = data
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local success, errormessage = pcall(function()
MyDataStore:SetAsync(player.UserId.."-coins",player.leaderstats.Coins.Value)
end)
end)
but idk, as i say, there are a few scripts related to the shop
this is not the one
but i see why there might be a problem
cuz you make the leaderstats folder twice
first in that other thing and now in this
did you make all this?
then who did?
idk
toolbox?
and the vid works?
cuz then you did something wrong and you'll have to double check everything yourself
well, the script work on my game
I think the problem is not that I did something wrong, but that I didn't do something.
then check if you missed something
How do I make it not create a new folder but relate it to the folder that the store script already creates so that there is the same place where the coins are stored?
what?
srry, im not really good explaining myself
how i do for NOT create a new folder but make the coins of this "CoinsPerSecond script" go to the folder that the "Shop script" has made yet?
u understan now?
just remove the part where it makes the folder
just make sure in the entire game it only makes the leaderstats folder once
and also the coins intval
okok
i do what you say but i dont understand at all this, can you explain it better?
also, thx for the help at the moment
** You are now Level 5! **
make sure theres only one leaderstats folder being made with instance.new in any script in the game
yes yes, i do it, also was a second folder duplicated folder that i delete, but the "persecond" script still isn't working, it dont give me the coins
