Output: Players.hokyboy.PlayerGui.Shop.Frame.Buy.LocalScript:8: attempt to compare number with string

script

local player = game.Players.LocalPlayer
local currency = player:WaitForChild("leaderstats")["????Coins"] -- Currency Name here.
local item = script.Parent.Parent.Parent.Item
local shop = game.Workspace.Shop
local tool = game.ReplicatedStorage:WaitForChild("Tools")

script.Parent.MouseButton1Click:Connect(function()
	if currency.Value >= shop:FindFirstChild("Part"..item.Value).ItemPrice.Value then
		if player.Backpack:FindFirstChild(shop:FindFirstChild("Part"..item.Value).ItemName.Value) == nil then
			if shop:FindFirstChild("Part"..item.Value) then
				currency.Value = currency.Value - shop:FindFirstChild("Part"..item.Value).ItemPrice.Value
				script.Parent.Text = "Bought"
				script.Parent.BackgroundColor3 = Color3.new(0.7,0.7,0.7)
				script.Parent.Shadow.BackgroundColor3 = Color3.new(0.5,0.5,0.5)
				game.ReplicatedStorage.ShopBuy:FireServer(item.Value)
			end
		end
 	end
end)

3 comments

0

What is the classname of item? (Bool, Object, String, etc...)

0

Item name is a string value price is a IntValue

0

Also tried numbervalue doesnt work either