local points = game:GetService("DataStoreService"):GetDataStore("Points") local text = script.Parent.TextLabel while wait() do text = "Coins : ".. points end
And This
local DataStore = game:GetService("DataStoreService"):GetDataStore("Points") game.Players.PlayerAdded:connect(function(player) local key = "user_".. player.userId DataStore:UpdateAsync(key, function(oldValue) local newValue = oldValue or 0 newValue = newValue + 50 end) end)
Do not work. How do I make these work? They should work, but this screen shot here shows 0 Coins (Yes I know, I'm not in game, but i tested it and they still do not work): http://prntscr.com/8mdigh
Well first off what are you adding to? Because the second script has no purpose other than changing in script variables.
The first script you need the value of the Points in the data store, hope this helps. I haven't answered in full, sorry. But anyway hope it helps.
Easy, assuming the script is a LocalScript in a screen gui:
local player=game:service'Players'.localPlayer repeat wait() until player local points = game:GetService("DataStoreService"):GetDataStore("Points")["user_"..player.userId] local text = script.Parent.TextLabel while wait() do text.Text = "Coins : ".. points end
you need Text property, as the TextLabel is an object
also, the second one can be fixed too:
local DataStore = game:GetService("DataStoreService"):GetDataStore("Points") game.Players.PlayerAdded:connect(function(player) local key = "user_".. player.userId local data=DataStore[key] if not data then DataStore[key]=0 end DataStore:UpdateAsync(key, function(oldValue) newValue = newValue + 50 end) end)
If it doesn't work, tell me ;p