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

Attempt to compare instance to value?

I'm trying to make a shop system but line 35 is giving me an error.

_G.ownedClasses = {}

function AddMoves(moveList, player)
	
	local playerMovesFolder = player.Backpack.Moves
	local playerMoves = playerMovesFolder:GetChildren()
	
	for i, move in ipairs(playerMoves) do
		
		move:Destroy()
	end
	
	for i, move in ipairs(moveList) do
		
		move.Parent = playerMovesFolder
	end
end

game.ReplicatedStorage.BuyOrEquip.OnServerEvent:Connect(function(player, name)
	
	local item = game.ServerStorage.Classes[name]
	local price = item.Price
	local skills = item.Moves:GetChildren()
	local coins = player.leaderstats.Coins
	local owns = false
	
	if table.find(_G.ownedClasses, name) then
		owns = true
	end
	
	if (owns) then
		AddMoves(skills, player)
	end
	
	if price < coins.Value and owns == false then
		
		AddMoves(skills, player)
		
		table.insert(_G.ownedClasses, name)

		coins.Value -= price
	end
end)

1 answer

✓ Accepted answer
price.Value

1 comment

0

AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH I can't believe I missed that

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