Expected identifier, got "$"

You can write your topic however you want, but you need to answer these questions:

Trying to make a gun buying system.

Syntax Error: (19,22) Expected identifier, got “$”

I have tried to use ‘’ instead of “” and no quotes or ‘’, neither helped.

Yes, the leaderstat is a $ sign.

local ClickDetector = script.Parent.ClickDetector
local canGiveGun = true
ClickDetector.MouseClick:Connect(function(player)
	
	
	
	local backpack = player.Backpack
	local gun = game.ServerStorage["G19"]
	local gunClone = gun:Clone()
	for i,v in pairs(backpack:GetChildren()) do 
		if v.Name == "G19" then
			canGiveGun=false
		end
	end
	if canGiveGun then
		gunClone.Parent = backpack
		--player.leaderstats.Money.Value - 1200
		player.leaderstats."$".Value = player.leaderstats."$".Value - 550
	end
	canGiveGun = true
end)

Im back with more problems on the same script as the last post, how exciting!

Try this. Should be fixed now.

local ClickDetector = script.Parent.ClickDetector
local canGiveGun = true
ClickDetector.MouseClick:Connect(function(player)
	local backpack = player.Backpack
	local gun = game.ServerStorage["G19"]
	local gunClone = gun:Clone()
	for i,v in pairs(backpack:GetChildren()) do 
		if v.Name == "G19" then
			canGiveGun=false
		end
	end
	if canGiveGun then
		gunClone.Parent = backpack
		--player.leaderstats.Money.Value - 1200
		player.leaderstats["$"].Value = player.leaderstats["$"].Value - 550
	end
	canGiveGun = true
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.