I keep getting this error trying to add a number to an int value

game.Players.PlayerAdded:Connect(function(player)
	script.Parent.Handle.Interaction.Triggered:Connect(function()

		local Tool = ReplicatedStorage.Tools.Chips:Clone()

		for _,v in pairs(player.Character:GetChildren()) do
			if v:IsA("Tool") then
				print("Didn't pick up the tool! Inventory full")
			end
		end
		
		for _,v in pairs(player.Backpack:GetChildren()) do
			if v:IsA("Tool") then
				print("Didn't pick up the tool! Inventory full")
			end
		end
		
		if #player.Backpack:GetChildren() == 0 then
			Tool.Parent = player.Backpack
			script.Parent:Destroy()
			
			game.ReplicatedStorage.Tools.Chips.Value += 1
			
		end
	end)
end)


every time i try and add 1 to an int value it gives me an error saying “Workspace.Tools.Chips.Script:25: attempt to perform arithmetic (add) on Instance and number”

Is Chips an IntValue or is Value the IntValue?

Try replacing this with:

game.ReplicatedStorage.Tools.Chips.Value.Value
2 Likes

the IntValue is inside the chips

Yeah, then you need to do Value.Value

wow i’m really dumb thanks dude

It’s okay, sometimes it can be slightly confusing since Roblox automatically names all values to Value, so you think you’re accessing the actual value when you are actually just accessing the instance.

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