Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

12:00:34.886 - ServerScriptService.Script:16: unexpected symbol near '?' Erorr ?

local DSS = game:GetService("DataStoreService")
local Money = DSS:GetDataStore("Money")



game.Players.PlayerAdded:Connect(function(plr)
 local pMoney = Money:GetAsync(plr.UserId)or 0
 local leaderstats = Instance.new("Folder",plr)
 leaderstats.Name = "leaderstats"
 local MoneyValue = Instance.new("NumberValue")
 MoneyValue.Name "Money"
 MoneyValue.Value = pMoney
 MoneyValue.Parent = leaderstats
 MoneyValue.Changed:connect(function(v)
  Money.setAsync(plr.UserId,v)
  print("Money Saved")
 end)
end)

This script is also continuous 12: 00: 34.886 - ServerScriptService.Script: 16: unexpected symbol near 'de' I'm getting error help me plsss

3 comments

0

Use Lua brackets around your code

0

Formatted code.

0

You should accept DinozCreates's answer! Oh I see you can't but please at least comment to his answer

2 answers

You have a couple errors in this. First, as Dinoz stated, you're missing an = operator on line 11. Secondly, it's :SetAsync(), not .setAsync(). Additionally, :connect() is deprecated. Use :Connect() instead.

local DSS = game:GetService("DataStoreService")
local Money = DSS:GetDataStore("Money")

game.Players.PlayerAdded:Connect(function(plr)
 local pMoney = Money:GetAsync(plr.UserId) or 0
 local leaderstats = Instance.new("Folder")
 leaderstats.Name = "leaderstats"
 leaderstats.Parent = plr
 local MoneyValue = Instance.new("NumberValue")
 MoneyValue.Name = "Money"
 MoneyValue.Value = pMoney
 MoneyValue.Parent = leaderstats
 
 MoneyValue.Changed:Connect(function(v)
  Money:SetAsync(plr.UserId,v)
  print("Money Saved")
 end)
end)

The final issue I noted was the usage of the second argument of .new(), which is deprecated due to performance issues. Read here for more information.


##Accept and upvote if this helps!

1 comment

0

betr

You were missing a = on what I have as line 9. I think this is what was causing your error?

local DSS = game:GetService("DataStoreService") 
local Money = DSS:GetDataStore("Money")

game.Players.PlayerAdded:Connect(function(plr) 
	local pMoney = Money:GetAsync(plr.UserId) or 0 
	local leaderstats = Instance.new("Folder",plr) 
	leaderstats.Name = "leaderstats" 
	local MoneyValue = Instance.new("NumberValue") 
	MoneyValue.Name = "Money" 
	MoneyValue.Value = pMoney 
	MoneyValue.Parent = leaderstats 

	MoneyValue.Changed:Connect(function(v) 
		Money.setAsync(plr.UserId,v) 
		print("Money Saved") 
	end) 
end)

1 comment

0

:SetAsync()

This discussion is preserved as it was. New answers, comments, and votes are closed.